move misplaced config for npx on windows
Massimo Melina committed
May 16, 2023 at 19:37 UTC
e1682c8c85dfd47eab8943dab0683876dde6b6f8
1 file changed
+3
-2
src/config.ts
+3
-2
@@ -1,7 +1,7 @@
1
// This file is part of HFS - Copyright 2021-2023, Massimo Melina <a@rejetto.com> - License https://www.gnu.org/licenses/gpl-3.0.txt
2
3
import EventEmitter from 'events'
4
-import { APP_PATH, argv, ORIGINAL_CWD, VERSION } from './const'
4
+import { argv, ORIGINAL_CWD, VERSION } from './const'
5
import { watchLoad } from './watchLoad'
6
import yaml from 'yaml'
7
import _ from 'lodash'
@@ -9,6 +9,7 @@ import { debounceAsync, same, newObj, onOff, wait, with_ } from './misc'
9
import { copyFileSync, existsSync, renameSync, statSync } from 'fs'
10
import { join, resolve } from 'path'
11
import events from './events'
12
+import { homedir } from 'os'
13
14
const FILE = 'config.yaml'
15
@@ -30,7 +31,7 @@ const filePath = with_(argv.config || process.env.HFS_CONFIG, p => {
31
catch {}
32
return p
33
})
33
-const legacyPosition = join(APP_PATH, FILE)
34
+const legacyPosition = join(homedir(), FILE) // this was happening with npx on Windows for some time. Remove around v0.47
35
if (!existsSync(filePath) && existsSync(legacyPosition))
36
try {
37
renameSync(legacyPosition, filePath)