Merge pull request #1737 from dpalou/MOBILE-2836

MOBILE-2836 gulp: Fix lang build in Windows
main
Juan Leyva 2019-01-28 18:43:12 +01:00 committed by GitHub
commit de16462c92
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 2 deletions

View File

@ -47,7 +47,13 @@ function treatFile(file, data) {
return; // ignore return; // ignore
} }
try { try {
var path = file.path.substr(file.path.lastIndexOf('/src/') + 5); var srcPos = file.path.lastIndexOf('/src/');
if (srcPos == -1) {
// It's probably a Windows environment.
srcPos = file.path.lastIndexOf('\\src\\');
}
var path = file.path.substr(srcPos + 5);
data[path] = JSON.parse(file.contents.toString()); data[path] = JSON.parse(file.contents.toString());
} catch (err) { } catch (err) {
console.log('Error parsing JSON: ' + err); console.log('Error parsing JSON: ' + err);
@ -65,7 +71,7 @@ function treatMergedData(data) {
var mergedOrdered = {}; var mergedOrdered = {};
for (var filepath in data) { for (var filepath in data) {
var pathSplit = filepath.split('/'), var pathSplit = filepath.split(/[\/\\]/),
prefix; prefix;
pathSplit.pop(); pathSplit.pop();