Windows mount handling for custom letters #115
Signed-off-by: FTCHD <144691102+FTCHD@users.noreply.github.com>
This commit is contained in:
+12
-2
@@ -14,6 +14,7 @@ const RE_BACKSLASH = /\\/g
|
|||||||
const RE_PATH_SEPARATOR = /[/\\]/
|
const RE_PATH_SEPARATOR = /[/\\]/
|
||||||
const RE_WINDOWS_EXTENDED_PATH = /(\/\/\?\/|\\\\\?\\)/
|
const RE_WINDOWS_EXTENDED_PATH = /(\/\/\?\/|\\\\\?\\)/
|
||||||
const RE_WINDOWS_DRIVE_ROOT = /^:local:[a-zA-Z]:\/$/
|
const RE_WINDOWS_DRIVE_ROOT = /^:local:[a-zA-Z]:\/$/
|
||||||
|
const RE_WINDOWS_DRIVE_LETTER = /^[a-zA-Z]:$/
|
||||||
|
|
||||||
function serializeOptions(
|
function serializeOptions(
|
||||||
remotePath: string,
|
remotePath: string,
|
||||||
@@ -510,10 +511,19 @@ export async function startMount({
|
|||||||
}
|
}
|
||||||
}) {
|
}) {
|
||||||
const currentPlatform = platform()
|
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 mountOptions = { ...(options.mount || {}) }
|
||||||
|
|
||||||
const hasVolumeName = 'volname' in mountOptions && mountOptions.volname && destination !== '*'
|
const hasVolumeName = 'volname' in mountOptions && mountOptions.volname
|
||||||
if (!hasVolumeName && needsVolumeName) {
|
if (!hasVolumeName && needsVolumeName) {
|
||||||
const segments = source.split(RE_PATH_SEPARATOR).filter(Boolean)
|
const segments = source.split(RE_PATH_SEPARATOR).filter(Boolean)
|
||||||
console.log('[Mount] segments', segments)
|
console.log('[Mount] segments', segments)
|
||||||
|
|||||||
Reference in New Issue
Block a user