1
1
using System ;
2
2
using System . Collections . ObjectModel ;
3
3
using System . ComponentModel ;
4
+ using System . IO ;
4
5
using System . Linq ;
5
6
using System . Windows ;
6
7
using System . Windows . Forms ;
@@ -14,6 +15,8 @@ namespace Flow.Launcher.Plugin.Explorer.Views;
14
15
[ INotifyPropertyChanged ]
15
16
public partial class QuickAccessLinkSettings
16
17
{
18
+ private static readonly string ClassName = nameof ( QuickAccessLinkSettings ) ;
19
+
17
20
private string _selectedPath ;
18
21
public string SelectedPath
19
22
{
@@ -27,6 +30,9 @@ public string SelectedPath
27
30
if ( string . IsNullOrEmpty ( _selectedName ) )
28
31
{
29
32
SelectedName = _selectedPath . GetPathName ( ) ;
33
+ }
34
+ if ( ! string . IsNullOrEmpty ( _selectedPath ) )
35
+ {
30
36
_accessLinkType = GetResultType ( _selectedPath ) ;
31
37
}
32
38
}
@@ -187,13 +193,13 @@ private void SelectPath_OnClick(object commandParameter, RoutedEventArgs e)
187
193
private static ResultType GetResultType ( string path )
188
194
{
189
195
// Check if the path is a file or folder
190
- if ( System . IO . File . Exists ( path ) )
196
+ if ( File . Exists ( path ) )
191
197
{
192
198
return ResultType . File ;
193
199
}
194
- else if ( System . IO . Directory . Exists ( path ) )
200
+ else if ( Directory . Exists ( path ) )
195
201
{
196
- if ( string . Equals ( System . IO . Path . GetPathRoot ( path ) , path , StringComparison . OrdinalIgnoreCase ) )
202
+ if ( string . Equals ( Path . GetPathRoot ( path ) , path , StringComparison . OrdinalIgnoreCase ) )
197
203
{
198
204
return ResultType . Volume ;
199
205
}
@@ -205,6 +211,7 @@ private static ResultType GetResultType(string path)
205
211
else
206
212
{
207
213
// 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.") ;
208
215
return ResultType . Folder ;
209
216
}
210
217
}
0 commit comments