config checking

Signed-off-by: FTCHD <144691102+FTCHD@users.noreply.github.com>
This commit is contained in:
FTCHD
2025-09-23 20:04:47 +02:00
parent 002f25b8c9
commit 98c985dad4
3 changed files with 6 additions and 35 deletions
+1 -1
View File
@@ -14,4 +14,4 @@ export const RCLONE_VFS_DEFAULTS = {
'ChunkStreams': 16,
}
export const RCLONE_CONF_REGEX = /\/rclone\.conf$/
export const RCLONE_CONF_REGEX = /[\/\\]rclone\.conf$/
+5 -10
View File
@@ -136,7 +136,7 @@ export async function initRclone(args: string[]) {
console.log('[initRclone] configFolderPath', configFolderPath)
if (activeConfigFile.sync) {
if (!(await exists(configFolderPath + sep() + 'rclone.conf'))) {
if (!(await exists(`${configFolderPath}${sep()}rclone.conf`))) {
await message('The config file could not be found. Switching to the default config.', {
title: 'Invalid synced config',
kind: 'error',
@@ -153,13 +153,8 @@ export async function initRclone(args: string[]) {
let password: string | null = activeConfigFile.pass || activeConfigFile.passCommand || null
try {
const configPath = `${configFolderPath}/rclone.conf`
const configPath = `${configFolderPath}${sep()}rclone.conf`
console.log('[initRclone] configPath', configPath)
const configPathExists = await exists(configPath).catch(() => false)
console.log('[initRclone] configPathExists', configPathExists)
if (!configPathExists) {
throw new Error('Config file does not exist')
}
const configContent = await readTextFile(configPath)
const isEncrypted = configContent.includes('RCLONE_ENCRYPT_V0:')
@@ -262,7 +257,7 @@ export async function initRclone(args: string[]) {
if (internal || activeConfigFile.id !== 'default') {
extraParams.env.RCLONE_CONFIG_DIR = configFolderPath
extraParams.env.RCLONE_CONFIG = `${configFolderPath}/rclone.conf`
extraParams.env.RCLONE_CONFIG = `${configFolderPath}${sep()}rclone.conf`
}
console.log('[initRclone] extraParams', extraParams)
@@ -388,7 +383,7 @@ export async function provisionRclone() {
try {
await invoke('unzip_file', {
zipPath,
outputFolder: `${tempDirPath}/rclone/extracted`,
outputFolder: `${tempDirPath}${sep()}rclone${sep()}extracted`,
})
console.log('[provisionRclone] successfully unzipped file')
} catch (error) {
@@ -436,7 +431,7 @@ export async function provisionRclone() {
console.log('[provisionRclone] appLocalDataDirPath created')
}
await copyFile(rcloneBinaryPath, `${appLocalDataDirPath}/${binaryName}`)
await copyFile(rcloneBinaryPath, `${appLocalDataDirPath}${sep()}${binaryName}`)
console.log('[provisionRclone] copied rclone binary')
const hasInstalled = await isInternalRcloneInstalled()
-24
View File
@@ -245,30 +245,6 @@
}
]
},
{
"identifier": "fs:allow-read-text-file",
"allow": [
{
"path": "*/**"
}
]
},
{
"identifier": "fs:allow-read-file",
"allow": [
{
"path": "*/**"
}
]
},
{
"identifier": "fs:allow-read-dir",
"allow": [
{
"path": "*/**"
}
]
},
"opener:allow-open-url",
{