Skip to content

Commit

Permalink
Merge pull request #4478 from wordpress-mobile/fix/localization-strin…
Browse files Browse the repository at this point in the history
…gs-file-destination-dir

Assure destination directory presence for localization strings files output
  • Loading branch information
fluiddot committed Jan 18, 2022
2 parents 8629e5c + 464565f commit b9eb1e4
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
7 changes: 7 additions & 0 deletions bin/strings2android.js
Expand Up @@ -188,6 +188,13 @@ if ( require.main === module ) {
}

const xmlOutput = strings2Android( onlyNativeStrings );

// Assure that the destination directory exists
const destinationDir = path.dirname( destination );
if ( ! fs.existsSync( destinationDir ) ) {
fs.mkdirSync( destinationDir, { recursive: true } );
}

fs.writeFileSync( destination, xmlOutput );
}

Expand Down
7 changes: 7 additions & 0 deletions bin/strings2swift.js
Expand Up @@ -67,6 +67,13 @@ if ( require.main === module ) {
}

const swiftOutput = strings2Swift( onlyNativeStrings );

// Assure that the destination directory exists
const destinationDir = path.dirname( destination );
if ( ! fs.existsSync( destinationDir ) ) {
fs.mkdirSync( destinationDir, { recursive: true } );
}

fs.writeFileSync( destination, swiftOutput );
}

Expand Down

0 comments on commit b9eb1e4

Please sign in to comment.