From a7c6cd3384305784e98174b00f12312bdd922159 Mon Sep 17 00:00:00 2001 From: jlukic Date: Thu, 12 Feb 2015 18:51:20 -0500 Subject: [PATCH] Fix paths in win --- tasks/config/project/config.js | 25 ++++++++++++------------- tasks/config/project/install.js | 6 +++--- 2 files changed, 15 insertions(+), 16 deletions(-) diff --git a/tasks/config/project/config.js b/tasks/config/project/config.js index 7cbceadae..624cd258a 100644 --- a/tasks/config/project/config.js +++ b/tasks/config/project/config.js @@ -19,34 +19,33 @@ module.exports = { getPath: function(file, directory) { var - configPath = '', + configPath, walk = function(directory) { var - currentPath = path.normalize( path.join(directory, file) ) + nextDirectory = path.resolve( path.join(directory, path.sep, '..') ), + currentPath = path.normalize( path.join(directory, file) ) ; if( fs.existsSync(currentPath) ) { // found file - configPath = path.normalize(directory); - return true; + configPath = path.normalize(currentPath); + return; } else { // reached file system root, let's stop - if(path.resolve(directory) == path.sep) { - return false; + if(nextDirectory == directory) { + return; } // otherwise recurse - walk(directory + '..' + path.sep, file); + walk(nextDirectory, file); } } ; - file = file || defaults.files.config; - directory = directory || __dirname + '/..'; - + // start walk from outside require-dot-files directory + file = file || defaults.files.config; + directory = directory || path.join(__dirname, path.sep, '..'); walk(directory); - - return configPath; - + return configPath || ''; }, // adds additional derived values to a config object diff --git a/tasks/config/project/install.js b/tasks/config/project/install.js index 9a7f2bc16..a05ffdba5 100644 --- a/tasks/config/project/install.js +++ b/tasks/config/project/install.js @@ -90,7 +90,7 @@ module.exports = { var pathArray = directory.split('/'), folder = pathArray[pathArray.length - 2], - nextDirectory = path.normalize(directory + '/../') + nextDirectory = path.join(directory + '..') ; if( folder == 'bower_components') { return { @@ -110,7 +110,7 @@ module.exports = { root: nextDirectory }; } - if(path.resolve(directory) == '/') { + if(path.resolve(directory) == path.resolve(nextDirectory)) { return false; } // recurse downward @@ -118,7 +118,7 @@ module.exports = { } ; // start walk from current directory if none specified - directory = directory || (__dirname + '/'); + directory = directory || (__dirname + path.sep); return walk(directory); },