Skip to content

Commit bc847fb

Browse files
committed
fix: find bin top to bottom instead of the inverse
1 parent 1e1e7d7 commit bc847fb

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@
6565
"merge-options": "^2.0.0",
6666
"multiaddr": "^6.1.1",
6767
"nanoid": "^2.1.9",
68+
"resolve-cwd": "^3.0.0",
6869
"temp-write": "^4.0.0"
6970
},
7071
"devDependencies": {

src/utils.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ const path = require('path')
55
const fs = require('fs-extra')
66
const debug = require('debug')
77
const nanoid = require('nanoid')
8+
const resolveCwd = require('resolve-cwd')
89
const isWindows = os.platform() === 'win32'
910

1011
const log = debug('ipfsd-ctl:utils')
@@ -42,10 +43,10 @@ const checkForRunningApi = (repoPath) => {
4243

4344
const findBin = (type) => {
4445
if (type === 'js') {
45-
return process.env.IPFS_JS_EXEC || require.resolve('ipfs/src/cli/bin.js')
46+
return process.env.IPFS_JS_EXEC || resolveCwd('ipfs/src/cli/bin.js')
4647
}
4748

48-
return process.env.IPFS_GO_EXEC || require.resolve(`go-ipfs-dep/go-ipfs/${isWindows ? 'ipfs.exe' : 'ipfs'}`)
49+
return process.env.IPFS_GO_EXEC || resolveCwd(`go-ipfs-dep/go-ipfs/${isWindows ? 'ipfs.exe' : 'ipfs'}`)
4950
}
5051

5152
const tmpDir = (type = '') => {

0 commit comments

Comments
 (0)