@samitouri / QOSami-HFS / commits / f56368fd

removed legacy workaround for config in wrong folder

Massimo Melina committed Aug 29, 2023 at 12:31 UTC f56368fdd04af7bf689a0738763e03c20b650d4c
1 file changed +2 -16
src/config.ts
+2 -16
@@ -5,11 +5,10 @@ import { argv, DAY, ORIGINAL_CWD, VERSION } from './const'
5 import { watchLoad } from './watchLoad'
6 import yaml from 'yaml'
7 import _ from 'lodash'
8 -import { debounceAsync, same, newObj, onOff, wait, with_ } from './misc'
9 -import { copyFileSync, existsSync, renameSync, statSync } from 'fs'
8 +import { debounceAsync, newObj, onOff, wait, with_ } from './misc'
9 +import { statSync } from 'fs'
10 import { join, resolve } from 'path'
11 import events from './events'
12 -import { homedir } from 'os'
12 import { copyFile, stat } from 'fs/promises'
13
14 const FILE = 'config.yaml'
@@ -32,19 +31,6 @@ const filePath = with_(argv.config || process.env.HFS_CONFIG, p => {
31 catch {}
32 return p
33 })
35 -const legacyPosition = join(homedir(), FILE) // this was happening with npx on Windows for some time. Remove around v0.47
36 -if (!existsSync(filePath) && existsSync(legacyPosition))
37 - try {
38 - renameSync(legacyPosition, filePath)
39 - console.log("moved from legacy position", legacyPosition)
40 - }
41 - catch {
42 - try { // attempt copying, in case moving the source file proves to be impractical
43 - copyFileSync(legacyPosition, filePath)
44 - console.log("copied from legacy position", legacyPosition)
45 - }
46 - catch {}
47 - }
34 // takes a semver like 1.2.3-alpha1, but alpha and beta numbers must share the number progression
35 export const versionToScalar = _.memoize((ver: string) => { // memoize so we don't have to care about converting same value twice
36 // this regexp is supposed to be resistant to optional leading "v" and an optional custom name after a space