aboutsummaryrefslogtreecommitdiffhomepage
path: root/cli
diff options
context:
space:
mode:
authorGirish Ramakrishnan <girish@forwardbias.in>2015-11-27 16:08:08 -0800
committerGirish Ramakrishnan <girish@forwardbias.in>2015-11-27 16:08:08 -0800
commit1c20715d8249ae081aae56f27e12e225282e9e38 (patch)
treeeb8a1c2853b7252c03c271b3d40b67c95d86fad3 /cli
parent755569a3d7aad123db0854e282b731d80c3f9ca2 (diff)
downloadSurfer-1c20715d8249ae081aae56f27e12e225282e9e38.tar.gz
Surfer-1c20715d8249ae081aae56f27e12e225282e9e38.tar.zst
Surfer-1c20715d8249ae081aae56f27e12e225282e9e38.zip
fix path resolution
Diffstat (limited to 'cli')
-rw-r--r--cli/actions.js10
1 files changed, 9 insertions, 1 deletions
diff --git a/cli/actions.js b/cli/actions.js
index 6fb9893..735b631 100644
--- a/cli/actions.js
+++ b/cli/actions.js
@@ -93,7 +93,15 @@ function put(filePath, otherFilePaths, options) {
93 var files = collectFiles([ filePath ].concat(otherFilePaths)); 93 var files = collectFiles([ filePath ].concat(otherFilePaths));
94 94
95 async.eachSeries(files, function (file, callback) { 95 async.eachSeries(files, function (file, callback) {
96 var relativeFilePath = path.resolve(file).slice(process.cwd().length + 1); 96 var relativeFilePath;
97 if (path.isAbsolute(file)) {
98 relativeFilePath = path.basename(file);
99 } else if (path.resolve(file).indexOf(process.cwd().length) === 0) { // relative to current dir
100 relativeFilePath = path.resolve(file).slice(process.cwd().length + 1);
101 } else { // relative but somewhere else
102 relativeFilePath = path.basename(file);
103 }
104
97 var destinationPath = (options.destination ? '/' + options.destination : '') + '/' + relativeFilePath; 105 var destinationPath = (options.destination ? '/' + options.destination : '') + '/' + relativeFilePath;
98 console.log('Uploading file %s -> %s', relativeFilePath.cyan, destinationPath.cyan); 106 console.log('Uploading file %s -> %s', relativeFilePath.cyan, destinationPath.cyan);
99 107