Fix for issue #9

The directory separator used in dir.lastIndexOf needs to be \ for Windows.
This commit is contained in:
oceanapplications 2017-10-18 13:52:12 -04:00 committed by GitHub
parent 45b8203eaa
commit 54f451692d
1 changed files with 9 additions and 2 deletions

View File

@ -47,7 +47,14 @@ function replaceAllImportsInCurrentLayer(i, importObjs, updatedFileContent, dir,
} else {
if (!variables.importedSrcFiles.hasOwnProperty(path.basename(dir + importObj.dependencyPath))) {
console.log("!!!" + importObj.dependencyPath + " SOURCE FILE NOT FOUND. TRY TO FIND IT RECURSIVELY!!!");
findFile.byNameAndReplace(dir.substring(0, dir.lastIndexOf("/")), path.basename(importObj.dependencyPath), updatedFileContent, importStatement, function(_updatedFileContent) {
if (process.platform == "win32") {
var directorySeperator = "\\";
} else {
directorySeperator = "/";
}
findFile.byNameAndReplace(dir.substring(0, dir.lastIndexOf(directorySeperator)), path.basename(importObj.dependencyPath), updatedFileContent, importStatement, function(_updatedFileContent) {
i++;
console.log("###" + importObj.dependencyPath + " SOURCE FILE FOUND###");
replaceAllImportsInCurrentLayer(i, importObjs, _updatedFileContent, dir, cb);