argument --cwd will now create a missing folder #690
Massimo Melina committed
Aug 25, 2024 at 00:37 UTC
efa6c296dd08e97d69df914a0a4dd2bd475136a7
1 file changed
+2
-4
src/const.ts
+2
-4
@@ -36,10 +36,8 @@ console.log('started', HFS_STARTED.toLocaleString(), DEV)
36
console.log('version', VERSION||'-')
37
console.log('build', BUILD_TIMESTAMP||'-')
38
const winExe = IS_WINDOWS && process.execPath.match(/(?<!node)\.exe$/i)
39
-if (argv.cwd)
40
- process.chdir(argv.cwd)
41
-else if (!winExe) { // still considering whether to use this behavior with Windows users, who may be less accustomed to it
42
- const dir = join(homedir(), '.hfs')
39
+const dir = argv.cwd || !winExe && join(homedir(), '.hfs') // still considering whether to use this behavior with Windows users, who may be less accustomed to it
40
+if (dir) {
41
try { mkdirSync(dir) }
42
catch(e: any) {
43
if (e.code !== 'EEXIST')