From 7324d10eaf0d4ffbffe27d1b3ba2a73273f2868b Mon Sep 17 00:00:00 2001 From: FTCHD <144691102+FTCHD@users.noreply.github.com> Date: Wed, 24 Dec 2025 01:24:05 +0700 Subject: [PATCH] Windows mount handling for custom letters #115 Signed-off-by: FTCHD <144691102+FTCHD@users.noreply.github.com> --- lib/rclone/api.ts | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/lib/rclone/api.ts b/lib/rclone/api.ts index efe011e..2685002 100644 --- a/lib/rclone/api.ts +++ b/lib/rclone/api.ts @@ -14,6 +14,7 @@ const RE_BACKSLASH = /\\/g const RE_PATH_SEPARATOR = /[/\\]/ const RE_WINDOWS_EXTENDED_PATH = /(\/\/\?\/|\\\\\?\\)/ const RE_WINDOWS_DRIVE_ROOT = /^:local:[a-zA-Z]:\/$/ +const RE_WINDOWS_DRIVE_LETTER = /^[a-zA-Z]:$/ function serializeOptions( remotePath: string, @@ -510,10 +511,19 @@ export async function startMount({ } }) { const currentPlatform = platform() - const needsVolumeName = ['windows', 'macos'].includes(currentPlatform) + let needsVolumeName = currentPlatform === 'macos' + + if ( + currentPlatform === 'windows' && + destination !== '*' && + !RE_WINDOWS_DRIVE_LETTER.test(destination) + ) { + needsVolumeName = true + } + const mountOptions = { ...(options.mount || {}) } - const hasVolumeName = 'volname' in mountOptions && mountOptions.volname && destination !== '*' + const hasVolumeName = 'volname' in mountOptions && mountOptions.volname if (!hasVolumeName && needsVolumeName) { const segments = source.split(RE_PATH_SEPARATOR).filter(Boolean) console.log('[Mount] segments', segments)