]> git.immae.eu Git - perso/Immae/Projets/Nodejs/Surfer.git/commitdiff
Fix relative path detection
authorJohannes Zellner <johannes@nebulon.de>
Mon, 30 Nov 2015 15:03:56 +0000 (16:03 +0100)
committerJohannes Zellner <johannes@nebulon.de>
Mon, 30 Nov 2015 15:03:56 +0000 (16:03 +0100)
cli/actions.js

index 25643da705a0070153af8ec6bff6f3f44f88a432..70803b22e7ecb355b60c24f4b79ed18fffacbaad 100644 (file)
@@ -97,9 +97,10 @@ function put(filePath, otherFilePaths, options) {
 
     async.eachSeries(files, function (file, callback) {
         var relativeFilePath;
+
         if (path.isAbsolute(file)) {
             relativeFilePath = path.basename(file);
-        } else if (path.resolve(file).indexOf(process.cwd().length) === 0) { // relative to current dir
+        } else if (path.resolve(file).indexOf(process.cwd()) === 0) { // relative to current dir
             relativeFilePath = path.resolve(file).slice(process.cwd().length + 1);
         } else { // relative but somewhere else
             relativeFilePath = path.basename(file);