MOBILE-2836 gulp: Fix lang build in Windows

main
Dani Palou 2019-01-21 11:37:59 +01:00
parent 7a79d56843
commit 0c738e3aaa
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();