Skip to content

Commit 6e696ca

Browse files
committed
actually fix relative julia path
1 parent f649f7a commit 6e696ca

File tree

1 file changed

+17
-9
lines changed

1 file changed

+17
-9
lines changed

lib/misc/paths.js

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,18 @@ export function expandHome (p) {
2424

2525
export function fullPath (p) {
2626
return new Promise((resolve, reject) => {
27-
if (fs.existsSync(p)) return resolve(fs.realpathSync(p))
27+
if (fs.existsSync(p)) {
28+
return resolve(fs.realpathSync(p))
29+
}
2830
const current_dir = process.cwd()
2931
const exepath = path.dirname(process.execPath)
30-
32+
3133
try {
3234
process.chdir(exepath)
3335
const realpath = fs.realpathSync(p)
34-
fs.existsSync(realpath) && resolve(realpath)
36+
if (fs.existsSync(realpath)) {
37+
resolve(realpath)
38+
}
3539
} catch (err) {
3640
console.log(err)
3741
} finally {
@@ -56,12 +60,16 @@ export function fullPath (p) {
5660

5761
export function getVersion (path = jlpath()) {
5862
return new Promise((resolve, reject) => {
59-
child_process.exec(`"${path}" --version`, (err, stdout, stderr) => {
60-
if (err) return reject(stderr)
61-
const res = stdout.match(/(\d+)\.(\d+)\.(\d+)/)
62-
if (!res) return reject('Couldn\'t resolve version.')
63-
const [_, major, minor, patch] = res
64-
return resolve({ major, minor, patch })
63+
fullPath(path).then(path => {
64+
child_process.exec(`"${path}" --version`, (err, stdout, stderr) => {
65+
if (err) return reject(stderr)
66+
const res = stdout.match(/(\d+)\.(\d+)\.(\d+)/)
67+
if (!res) return reject('Couldn\'t resolve version.')
68+
const [_, major, minor, patch] = res
69+
return resolve({ major, minor, patch })
70+
})
71+
}).catch(e => {
72+
reject('Couldn\'t resolve version.')
6573
})
6674
})
6775
}

0 commit comments

Comments
 (0)