fix & logs for writeFile error

Signed-off-by: FTCHD <144691102+FTCHD@users.noreply.github.com>
This commit is contained in:
FTCHD
2025-09-11 14:48:36 +02:00
parent 4aa3aded41
commit 88c9d2d2ae
2 changed files with 11 additions and 2 deletions
+7 -1
View File
@@ -19,7 +19,13 @@ export async function getDefaultPaths() {
console.log('[getDefaultPaths] json', JSON.stringify(defaultPaths, null, 2))
return defaultPaths
const doubleBackslashRegex = /\\/g
return {
cache: defaultPaths.cache ? defaultPaths.cache.replace(doubleBackslashRegex, '/') : '',
config: defaultPaths.config ? defaultPaths.config.replace(doubleBackslashRegex, '/') : '',
temp: defaultPaths.temp ? defaultPaths.temp.replace(doubleBackslashRegex, '/') : '',
}
}
export async function getDefaultPath(type: 'system' | 'internal') {
+4 -1
View File
@@ -39,10 +39,13 @@ export async function initRclone(args: string[]) {
let activeConfigFile = state.activeConfigFile
const defaultPath = await getDefaultPath(system ? 'system' : 'internal')
console.log('[initRclone] defaultPath', defaultPath)
if (system) {
const hasConfig = await exists(defaultPath).catch(() => false)
if (!hasConfig) {
await writeFile(defaultPath, new Uint8Array())
// const data = new Uint8Array([32]) // ASCII code for space character
await writeFile(defaultPath, new Uint8Array([]))
}
}