From 6905698bccf806ea82826ce29cfedf1ef347affb Mon Sep 17 00:00:00 2001 From: Jonathan Rainville Date: Tue, 10 Apr 2018 16:02:59 -0400 Subject: [PATCH] fix swarm upload too --- lib/modules/ipfs/upload.js | 2 +- lib/modules/swarm/upload.js | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/modules/ipfs/upload.js b/lib/modules/ipfs/upload.js index 25ed1025a..da9e6191b 100644 --- a/lib/modules/ipfs/upload.js +++ b/lib/modules/ipfs/upload.js @@ -18,7 +18,7 @@ class IPFS { function findBinary(callback) { let ipfs_bin = shelljs.which(self.configIpfsBin); - if (ipfs_bin === 'ipfs not found' || ipfs_bin === '') { + if (ipfs_bin === 'ipfs not found' || !ipfs_bin) { console.log(('=== WARNING: ' + self.configIpfsBin + ' not found or not in the path. Guessing ~/go/bin/ipfs for path').yellow); ipfs_bin = "~/go/bin/ipfs"; } diff --git a/lib/modules/swarm/upload.js b/lib/modules/swarm/upload.js index af14759a5..4ba0a9b39 100644 --- a/lib/modules/swarm/upload.js +++ b/lib/modules/swarm/upload.js @@ -12,9 +12,9 @@ class Swarm { let self = this; async.waterfall([ function findBinary(callback) { - let swarm_bin = shelljs.exec('which swarm').output.split("\n")[0]; + let swarm_bin = shelljs.which('swarm'); - if (swarm_bin === 'swarm not found' || swarm_bin === '') { + if (swarm_bin === 'swarm not found' || !swarm_bin) { console.log('=== WARNING: Swarm not in an executable path. Guessing ~/go/bin/swarm for path'.yellow); swarm_bin = "~/go/bin/swarm"; } @@ -22,7 +22,7 @@ class Swarm { return callback(null, swarm_bin); }, function runCommand(swarm_bin, callback) { - let cmd = swarm_bin + " --defaultpath " + self.buildDir + "index.html --recursive up " + self.buildDir; + let cmd = `"${swarm_bin}" --defaultpath ${self.buildDir} index.html --recursive up ${self.buildDir}`; console.log(("=== adding " + self.buildDir + " to swarm").green); console.log(cmd.green); let result = shelljs.exec(cmd);