From d9e6256a2932f2fe5e31ffe5dfabd3f71cd5dfa3 Mon Sep 17 00:00:00 2001 From: Fernando Lopez Guevara Date: Mon, 9 Jan 2017 12:19:10 -0300 Subject: [PATCH] Update WinSDK.js to handle recursively translation files fix issue - https://crosswalk-project.org/jira/projects/XWALK/issues/XWALK-7420?filter=allopenissues --- windows/lib/WixSDK.js | 34 ++++++++++++++++++++++------------ 1 file changed, 22 insertions(+), 12 deletions(-) diff --git a/windows/lib/WixSDK.js b/windows/lib/WixSDK.js index 4393658..021074a 100644 --- a/windows/lib/WixSDK.js +++ b/windows/lib/WixSDK.js @@ -226,18 +226,28 @@ function(app_path, xwalk_path, meta_data, callback) { return node; } - var locales_path = path.join(xwalk_path, 'locales', 'xwalk'); - if (!fs.existsSync(locales_path)) - locales_path = path.join(xwalk_path, 'locales'); - if (fs.existsSync(locales_path)) { - var locales = fs.readdirSync(locales_path); - locales.forEach(function (locale) { - AddFileComponent(GetFolderNode('locales', app_root_folder), locales_path, locale); - }); - } else { - output.error("Folder 'locales' not found in " + xwalk_path); - output.error("Missing i18n support"); - } + function addRecursiveLocales(original_path, sub_folder, root_folder) { + var locales = fs.readdirSync(original_path); + + locales.forEach(function(locale) { + var l_path = path.join(original_path, locale); + + if (fs.lstatSync(l_path).isFile()) { + AddFileComponent(GetFolderNode(sub_folder, root_folder), original_path, locale); + } else if (fs.lstatSync(l_path).isDirectory()) { + addRecursiveLocales(l_path, locale, GetFolderNode(sub_folder, root_folder)); + } + }); + } + + var locales_path = path.join(xwalk_path, 'locales'); + + if (fs.existsSync(locales_path)) { + addRecursiveLocales(locales_path, 'locales', app_root_folder); + } else { + output.error("Folder 'locales' not found in " + xwalk_path); + output.error("Missing i18n support"); + } // @skip_array contains absolute path of those need to be skipped, items can be // directory or files.