From 2856da83c1bcb23636b393047cae82681cc398b4 Mon Sep 17 00:00:00 2001 From: Jack251970 <1160210343@qq.com> Date: Tue, 8 Jul 2025 09:44:17 +0800 Subject: [PATCH 1/3] Fix quick access link type fetching issue --- .../Views/QuickAccessLinkSettings.xaml.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Views/QuickAccessLinkSettings.xaml.cs b/Plugins/Flow.Launcher.Plugin.Explorer/Views/QuickAccessLinkSettings.xaml.cs index eb66e1efca5..7261d37e284 100644 --- a/Plugins/Flow.Launcher.Plugin.Explorer/Views/QuickAccessLinkSettings.xaml.cs +++ b/Plugins/Flow.Launcher.Plugin.Explorer/Views/QuickAccessLinkSettings.xaml.cs @@ -27,6 +27,9 @@ public string SelectedPath if (string.IsNullOrEmpty(_selectedName)) { SelectedName = _selectedPath.GetPathName(); + } + if (!string.IsNullOrEmpty(_selectedPath)) + { _accessLinkType = GetResultType(_selectedPath); } } From bad7db69dc252e96de5002f42ede8ddebcf24c65 Mon Sep 17 00:00:00 2001 From: Jack251970 <1160210343@qq.com> Date: Tue, 8 Jul 2025 09:45:54 +0800 Subject: [PATCH 2/3] Improve code quality --- Plugins/Flow.Launcher.Plugin.Explorer/Main.cs | 2 +- .../Views/QuickAccessLinkSettings.xaml.cs | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Main.cs b/Plugins/Flow.Launcher.Plugin.Explorer/Main.cs index 0d1d99f8a1b..f1aea98b4bf 100644 --- a/Plugins/Flow.Launcher.Plugin.Explorer/Main.cs +++ b/Plugins/Flow.Launcher.Plugin.Explorer/Main.cs @@ -97,7 +97,7 @@ public string GetTranslatedPluginDescription() return Context.API.GetTranslation("plugin_explorer_plugin_description"); } - private void FillQuickAccessLinkNames() + private static void FillQuickAccessLinkNames() { // Legacy version does not have names for quick access links, so we fill them with the path name. foreach (var link in Settings.QuickAccessLinks) diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Views/QuickAccessLinkSettings.xaml.cs b/Plugins/Flow.Launcher.Plugin.Explorer/Views/QuickAccessLinkSettings.xaml.cs index 7261d37e284..818e597247f 100644 --- a/Plugins/Flow.Launcher.Plugin.Explorer/Views/QuickAccessLinkSettings.xaml.cs +++ b/Plugins/Flow.Launcher.Plugin.Explorer/Views/QuickAccessLinkSettings.xaml.cs @@ -1,6 +1,7 @@ using System; using System.Collections.ObjectModel; using System.ComponentModel; +using System.IO; using System.Linq; using System.Windows; using System.Windows.Forms; @@ -190,13 +191,13 @@ private void SelectPath_OnClick(object commandParameter, RoutedEventArgs e) private static ResultType GetResultType(string path) { // Check if the path is a file or folder - if (System.IO.File.Exists(path)) + if (File.Exists(path)) { return ResultType.File; } - else if (System.IO.Directory.Exists(path)) + else if (Directory.Exists(path)) { - if (string.Equals(System.IO.Path.GetPathRoot(path), path, StringComparison.OrdinalIgnoreCase)) + if (string.Equals(Path.GetPathRoot(path), path, StringComparison.OrdinalIgnoreCase)) { return ResultType.Volume; } From fe3babd4fc8d57a7532fda4dc16cdbe6c97dc330 Mon Sep 17 00:00:00 2001 From: Jack251970 <1160210343@qq.com> Date: Tue, 8 Jul 2025 09:50:12 +0800 Subject: [PATCH 3/3] Log error when fail to fetch type --- .../Views/QuickAccessLinkSettings.xaml.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Views/QuickAccessLinkSettings.xaml.cs b/Plugins/Flow.Launcher.Plugin.Explorer/Views/QuickAccessLinkSettings.xaml.cs index 818e597247f..e6294b98b65 100644 --- a/Plugins/Flow.Launcher.Plugin.Explorer/Views/QuickAccessLinkSettings.xaml.cs +++ b/Plugins/Flow.Launcher.Plugin.Explorer/Views/QuickAccessLinkSettings.xaml.cs @@ -15,6 +15,8 @@ namespace Flow.Launcher.Plugin.Explorer.Views; [INotifyPropertyChanged] public partial class QuickAccessLinkSettings { + private static readonly string ClassName = nameof(QuickAccessLinkSettings); + private string _selectedPath; public string SelectedPath { @@ -209,6 +211,7 @@ private static ResultType GetResultType(string path) else { // This should not happen, but just in case, we assume it's a folder + Main.Context.API.LogError(ClassName, $"The path '{path}' does not exist or is invalid. Defaulting to Folder type."); return ResultType.Folder; } }