From 464565f328d7a5c951e20574c5d901833398f7a7 Mon Sep 17 00:00:00 2001 From: Carlos Garcia Date: Mon, 17 Jan 2022 16:06:05 +0100 Subject: [PATCH] Assure directory for localization strings files output --- bin/strings2android.js | 7 +++++++ bin/strings2swift.js | 7 +++++++ 2 files changed, 14 insertions(+) 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 ); }