Skip to content

Commit d0c733b

Browse files
authored
Merge pull request #3810 from Flow-Launcher/quick_access_link_type
Fix Quick Access Link Type Fetching Issue
2 parents 48d0898 + fe3babd commit d0c733b

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

Plugins/Flow.Launcher.Plugin.Explorer/Main.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ public string GetTranslatedPluginDescription()
9797
return Context.API.GetTranslation("plugin_explorer_plugin_description");
9898
}
9999

100-
private void FillQuickAccessLinkNames()
100+
private static void FillQuickAccessLinkNames()
101101
{
102102
// Legacy version does not have names for quick access links, so we fill them with the path name.
103103
foreach (var link in Settings.QuickAccessLinks)

Plugins/Flow.Launcher.Plugin.Explorer/Views/QuickAccessLinkSettings.xaml.cs

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
using System;
22
using System.Collections.ObjectModel;
33
using System.ComponentModel;
4+
using System.IO;
45
using System.Linq;
56
using System.Windows;
67
using System.Windows.Forms;
@@ -14,6 +15,8 @@ namespace Flow.Launcher.Plugin.Explorer.Views;
1415
[INotifyPropertyChanged]
1516
public partial class QuickAccessLinkSettings
1617
{
18+
private static readonly string ClassName = nameof(QuickAccessLinkSettings);
19+
1720
private string _selectedPath;
1821
public string SelectedPath
1922
{
@@ -27,6 +30,9 @@ public string SelectedPath
2730
if (string.IsNullOrEmpty(_selectedName))
2831
{
2932
SelectedName = _selectedPath.GetPathName();
33+
}
34+
if (!string.IsNullOrEmpty(_selectedPath))
35+
{
3036
_accessLinkType = GetResultType(_selectedPath);
3137
}
3238
}
@@ -187,13 +193,13 @@ private void SelectPath_OnClick(object commandParameter, RoutedEventArgs e)
187193
private static ResultType GetResultType(string path)
188194
{
189195
// Check if the path is a file or folder
190-
if (System.IO.File.Exists(path))
196+
if (File.Exists(path))
191197
{
192198
return ResultType.File;
193199
}
194-
else if (System.IO.Directory.Exists(path))
200+
else if (Directory.Exists(path))
195201
{
196-
if (string.Equals(System.IO.Path.GetPathRoot(path), path, StringComparison.OrdinalIgnoreCase))
202+
if (string.Equals(Path.GetPathRoot(path), path, StringComparison.OrdinalIgnoreCase))
197203
{
198204
return ResultType.Volume;
199205
}
@@ -205,6 +211,7 @@ private static ResultType GetResultType(string path)
205211
else
206212
{
207213
// This should not happen, but just in case, we assume it's a folder
214+
Main.Context.API.LogError(ClassName, $"The path '{path}' does not exist or is invalid. Defaulting to Folder type.");
208215
return ResultType.Folder;
209216
}
210217
}

0 commit comments

Comments
 (0)