From c36af0a259b90ea336e3cb52f09091f4bcaf0f77 Mon Sep 17 00:00:00 2001 From: Florian Schwalm Date: Fri, 18 Dec 2020 15:34:24 +0100 Subject: [PATCH] Fixes #1045 - Correctly resolve mapped drive on Windows Use fs.realpath to get a path starting with the drive letter for mapped drives. The previously used fs.realpath.native function returned UNC paths on Windows, even if the path is actually using a drive letter --- src/git/gitService.ts | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/src/git/gitService.ts b/src/git/gitService.ts index 13a0ee05cf3df..3c4b8443d2f17 100644 --- a/src/git/gitService.ts +++ b/src/git/gitService.ts @@ -3051,17 +3051,12 @@ export class GitService implements Disposable { try { const networkPath = await new Promise(resolve => - fs.realpath.native(`${letter}:`, { encoding: 'utf8' }, (err, resolvedPath) => + fs.realpath(`${letter}:`, { encoding: 'utf8' }, (err, resolvedPath) => resolve(err != null ? undefined : resolvedPath), ), ); if (networkPath != null) { - return Strings.normalizePath( - repoUri.fsPath.replace( - networkPath, - `${letter.toLowerCase()}:${networkPath.endsWith('\\') ? '\\' : ''}`, - ), - ); + return networkPath; } } catch {} }