11using System ;
22using System . Collections . ObjectModel ;
33using System . ComponentModel ;
4+ using System . IO ;
45using System . Linq ;
56using System . Windows ;
67using System . Windows . Forms ;
@@ -14,6 +15,8 @@ namespace Flow.Launcher.Plugin.Explorer.Views;
1415[ INotifyPropertyChanged ]
1516public 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