diff --git a/bin/strings2android.js b/bin/strings2android.js index f35e02d9b6..450032e9b0 100755 --- a/bin/strings2android.js +++ b/bin/strings2android.js @@ -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 ); } diff --git a/bin/strings2swift.js b/bin/strings2swift.js index 6af89e2082..67f8be1116 100755 --- a/bin/strings2swift.js +++ b/bin/strings2swift.js @@ -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 ); }