From 3512de6ba27b77832a7d4f10da4afb629d1f0b9e Mon Sep 17 00:00:00 2001 From: area Date: Mon, 11 Jan 2016 14:54:02 +0000 Subject: [PATCH] Add support for other paths for ipfs binary Use `which` to locate `ipfs` rather than guessing. --- lib/ipfs.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/ipfs.js b/lib/ipfs.js index 5fb505f7..8577f9bb 100644 --- a/lib/ipfs.js +++ b/lib/ipfs.js @@ -1,9 +1,14 @@ require('shelljs/global'); ipfs = function(build_dir) { - ipfs_path = "~/go/bin"; + ipfs_bin = exec('which ipfs').output.split("\n")[0] - cmd = ipfs_path + "/ipfs add -r " + build_dir; + if (ipfs_bin==='ipfs not found'){ + console.log('=== WARNING: IPFS not in an executable path. Guessing ~/go/bin/ipfs for path') + ipfs_bin = "~/go/bin/ipfs"; + } + + cmd = ipfs_bin + " add -r " + build_dir; console.log("=== adding " + cmd + " to ipfs");