store platform in config.yaml mostly for debugging purposes
Massimo Melina committed
Feb 23, 2026 at 23:03 UTC
7538bb4565f621f58826f820b5b42ad178979c7d
1 file changed
+8
-5
src/config.ts
+8
-5
@@ -1,13 +1,13 @@
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 { ORIGINAL_CWD, VERSION, CONFIG_FILE } from './const'
3
+import { ORIGINAL_CWD, VERSION, CONFIG_FILE, IS_BINARY } from './const'
4
import { watchLoad } from './watchLoad'
5
import yaml from 'yaml'
6
import _ from 'lodash'
7
-import { DAY, newObj, throw_, tryJson, wait, with_ } from './cross'
7
+import { DAY, newObj, prefix, throw_, tryJson, wait, with_ } from './cross'
8
import { debounceAsync } from './debounceAsync'
9
import { statSync } from 'fs'
10
-import { join, resolve } from 'path'
10
+import { basename, join, resolve } from 'path'
11
import events from './events'
12
import { copyFile } from 'fs/promises'
13
import { produce, setAutoFreeze } from 'immer'
@@ -186,8 +186,11 @@ const saveDebounced = debounceAsync(async () => {
186
if (await statWithTimeout(bak).then(x => aWeekAgo > x.mtimeMs, () => true))
187
await copyFile(filePath, bak).catch(() => {}) // ignore errors
188
189
- await configFile.save(stringify({ ...state, version: VERSION }))
190
- .catch(err => console.error('Failed at saving config file, please ensure it is writable.', String(err)))
189
+ await configFile.save(stringify({
190
+ ...state,
191
+ version: VERSION,
192
+ platform: `${process.platform}-${process.arch}${prefix('-', !IS_BINARY && basename(process.execPath))}`,
193
+ })).catch(err => console.error('Failed at saving config file, please ensure it is writable.', String(err)))
194
})
195
export const saveConfigAsap = () => void saveDebounced()
196