From 045f7a20747c0a3f1348f4844322f80fd2f8a263 Mon Sep 17 00:00:00 2001 From: FTCHD Date: Sun, 2 Feb 2025 09:59:07 +0200 Subject: [PATCH] fix binary path on windows --- lib/rclone/init.ts | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/lib/rclone/init.ts b/lib/rclone/init.ts index 0b971a3..49b6ea6 100644 --- a/lib/rclone/init.ts +++ b/lib/rclone/init.ts @@ -174,10 +174,19 @@ export async function provisionRclone() { const unarchivedPath = `${tempDirPath}/rclone/rclone-ui/rclone-v${currentVersion}-${currentOs}-${arch}` console.log('unarchivedPath', unarchivedPath) - const rcloneBinaryPath = unarchivedPath + '/' + 'rclone' + const binaryName = currentPlatform === 'windows' ? 'rclone.exe' : 'rclone' + + const rcloneBinaryPath = unarchivedPath + '/' + binaryName console.log('rcloneBinaryPath', rcloneBinaryPath) - if (!(await exists(rcloneBinaryPath))) { + try { + const binaryExists = await exists(rcloneBinaryPath) + console.log('rcloneBinaryPathExists', binaryExists) + if (!binaryExists) { + throw new Error('Could not find rclone binary in zip') + } + } catch (error) { + console.error('Failed to check if rclone binary exists', error) throw new Error('Could not find rclone binary in zip') } @@ -194,7 +203,7 @@ export async function provisionRclone() { console.log('appLocalDataDirPath created') } - await copyFile(rcloneBinaryPath, `${appLocalDataDirPath}/rclone`) + await copyFile(rcloneBinaryPath, `${appLocalDataDirPath}/${binaryName}`) console.log('copied rclone binary') const hasInstalled = await isInternalRcloneInstalled()