fix: bad cwd with npx on Windows
Massimo Melina committed
May 8, 2023 at 12:59 UTC
131c1e5c2db554e4cf92a725e97f639cd4649c51
1 file changed
+2
-1
src/const.ts
+2
-1
@@ -58,9 +58,10 @@ console.log('started', HFS_STARTED.toLocaleString(), DEV)
58
console.log('version', VERSION||'-')
59
console.log('build', BUILD_TIMESTAMP||'-')
60
console.log('pid', process.pid)
61
+const winExe = IS_WINDOWS && process.execPath.match(/(?<!node)\.exe$/i)
62
if (argv.cwd)
63
process.chdir(argv.cwd)
63
-else if (!process.execPath.endsWith('.exe')) { // still considering whether to use this behavior with Windows users, who may be less accustomed to it
64
+else if (!winExe) { // still considering whether to use this behavior with Windows users, who may be less accustomed to it
65
const dir = join(homedir(), '.hfs')
66
try { mkdirSync(dir) }
67
catch(e: any) {