fix swarm upload too

This commit is contained in:
Jonathan Rainville 2018-04-10 16:02:59 -04:00
parent e731495109
commit 6905698bcc
2 changed files with 4 additions and 4 deletions

View File

@ -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";
}

View File

@ -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);