From e6fb01e0f2a63c347b9bba3085fc61a48396e300 Mon Sep 17 00:00:00 2001 From: hishitetsu <66369541+hishitetsu@users.noreply.github.com> Date: Wed, 29 Mar 2023 11:47:42 +0900 Subject: [PATCH 1/2] Fix pin shell path to favorites --- src/Files.App/Filesystem/Drives.cs | 3 ++- src/Files.App/ViewModels/ItemViewModel.cs | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Files.App/Filesystem/Drives.cs b/src/Files.App/Filesystem/Drives.cs index 0a1f7ba340c2..a881bc1a2f8a 100644 --- a/src/Files.App/Filesystem/Drives.cs +++ b/src/Files.App/Filesystem/Drives.cs @@ -91,7 +91,8 @@ public static async Task GetRootFromPathAsync(string devi return new StorageFolderWithPath(matchingDrive, rootPath); } } - else if (devicePath.StartsWith(@"\\", StringComparison.Ordinal)) // Network share + else if (devicePath.StartsWith(@"\\", StringComparison.Ordinal) && + !devicePath.StartsWith(@"\\SHELL\", StringComparison.Ordinal)) // Network share { int lastSepIndex = rootPath.LastIndexOf(@"\", StringComparison.Ordinal); rootPath = lastSepIndex > 1 ? rootPath.Substring(0, lastSepIndex) : rootPath; // Remove share name diff --git a/src/Files.App/ViewModels/ItemViewModel.cs b/src/Files.App/ViewModels/ItemViewModel.cs index c346e80bfb37..30ff71e84b98 100644 --- a/src/Files.App/ViewModels/ItemViewModel.cs +++ b/src/Files.App/ViewModels/ItemViewModel.cs @@ -1478,6 +1478,7 @@ public async Task EnumerateItemsFromStandardFolderAsync(string path, Cancel bool isWslDistro = App.WSLDistroManager.TryGetDistro(path, out _); bool isNetwork = path.StartsWith(@"\\", StringComparison.Ordinal) && !path.StartsWith(@"\\?\", StringComparison.Ordinal) && + !path.StartsWith(@"\\SHELL\", StringComparison.Ordinal) && !isWslDistro; bool enumFromStorageFolder = isBoxFolder; From 3e0c52cf06a69df45770f84bdf044f14fab2dc5d Mon Sep 17 00:00:00 2001 From: hishitetsu <66369541+hishitetsu@users.noreply.github.com> Date: Wed, 29 Mar 2023 12:00:43 +0900 Subject: [PATCH 2/2] Fix comment --- src/Files.App/Filesystem/Drives.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Files.App/Filesystem/Drives.cs b/src/Files.App/Filesystem/Drives.cs index a881bc1a2f8a..1ed16077a5c9 100644 --- a/src/Files.App/Filesystem/Drives.cs +++ b/src/Files.App/Filesystem/Drives.cs @@ -91,8 +91,9 @@ public static async Task GetRootFromPathAsync(string devi return new StorageFolderWithPath(matchingDrive, rootPath); } } + // Network share else if (devicePath.StartsWith(@"\\", StringComparison.Ordinal) && - !devicePath.StartsWith(@"\\SHELL\", StringComparison.Ordinal)) // Network share + !devicePath.StartsWith(@"\\SHELL\", StringComparison.Ordinal)) { int lastSepIndex = rootPath.LastIndexOf(@"\", StringComparison.Ordinal); rootPath = lastSepIndex > 1 ? rootPath.Substring(0, lastSepIndex) : rootPath; // Remove share name