don't try to write to program-files folder
Massimo Melina committed
Aug 25, 2024 at 10:07 UTC
ad1453755a8dfd872aef59bf0879b4808cb361c3
1 file changed
+3
-1
src/const.ts
+3
-1
@@ -36,7 +36,9 @@ 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
-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
39
+// still considering whether to use ".hfs" with Windows users, who may be less accustomed to it
40
+const useHomeDir = !winExe || process.execPath.includes(process.env.ProgramFiles||'|') // you can't write in program-files
41
+const dir = argv.cwd || useHomeDir && join(homedir(), '.hfs')
42
if (dir) {
43
try { mkdirSync(dir) }
44
catch(e: any) {