@@ -276,7 +276,7 @@ public int GridViewSize
276
276
public event EventHandler < GroupOption > GroupOptionPreferenceUpdated ;
277
277
278
278
public event EventHandler < SortDirection > SortDirectionPreferenceUpdated ;
279
-
279
+
280
280
public event EventHandler < bool > SortDirectoriesAlongsideFilesPreferenceUpdated ;
281
281
282
282
public SortOption DirectorySortOption
@@ -330,8 +330,8 @@ public bool SortDirectoriesAlongsideFiles
330
330
{
331
331
if ( SetProperty ( ref LayoutPreference . SortDirectoriesAlongsideFiles , value , nameof ( SortDirectoriesAlongsideFiles ) ) )
332
332
{
333
- LayoutPreferencesUpdateRequired ? . Invoke ( this , new LayoutPreferenceEventArgs ( LayoutPreference ) ) ;
334
- SortDirectoriesAlongsideFilesPreferenceUpdated ? . Invoke ( this , SortDirectoriesAlongsideFiles ) ;
333
+ LayoutPreferencesUpdateRequired ? . Invoke ( this , new LayoutPreferenceEventArgs ( LayoutPreference ) ) ;
334
+ SortDirectoriesAlongsideFilesPreferenceUpdated ? . Invoke ( this , SortDirectoriesAlongsideFiles ) ;
335
335
}
336
336
}
337
337
}
@@ -351,8 +351,11 @@ public static LayoutPreferences GetLayoutPreferencesForPath(string folderPath)
351
351
IUserSettingsService userSettingsService = Ioc . Default . GetService < IUserSettingsService > ( ) ;
352
352
if ( userSettingsService . PreferencesSettingsService . AreLayoutPreferencesPerFolder )
353
353
{
354
- var layoutPrefs = ReadLayoutPreferencesFromAds ( folderPath . TrimEnd ( '\\ ' ) ) ;
355
- return layoutPrefs ?? ReadLayoutPreferencesFromSettings ( folderPath . TrimEnd ( '\\ ' ) . Replace ( '\\ ' , '_' ) ) ;
354
+ folderPath = folderPath . TrimEnd ( '\\ ' ) ;
355
+ var layoutPrefs = ReadLayoutPreferencesFromAds ( folderPath ) ;
356
+ return layoutPrefs ??
357
+ ReadLayoutPreferencesFromSettings ( folderPath . Replace ( '\\ ' , '_' ) ) ??
358
+ GetDefaultPreferences ( folderPath ) ;
356
359
}
357
360
358
361
return LayoutPreferences . DefaultLayoutPreferences ;
@@ -428,15 +431,21 @@ private static LayoutPreferences ReadLayoutPreferencesFromSettings(string folder
428
431
return LayoutPreferences . DefaultLayoutPreferences ;
429
432
}
430
433
431
- IUserSettingsService userSettingsService = Ioc . Default . GetService < IUserSettingsService > ( ) ;
432
434
ApplicationDataContainer dataContainer = localSettings . CreateContainer ( "LayoutModeContainer" , ApplicationDataCreateDisposition . Always ) ;
433
435
folderPath = new string ( folderPath . TakeLast ( 254 ) . ToArray ( ) ) ;
434
436
if ( dataContainer . Values . ContainsKey ( folderPath ) )
435
437
{
436
438
ApplicationDataCompositeValue adcv = ( ApplicationDataCompositeValue ) dataContainer . Values [ folderPath ] ;
437
439
return LayoutPreferences . FromCompositeValue ( adcv ) ;
438
440
}
439
- else if ( folderPath == CommonPaths . DownloadsPath )
441
+
442
+ return null ;
443
+ }
444
+
445
+ private static LayoutPreferences GetDefaultPreferences ( string folderPath )
446
+ {
447
+ IUserSettingsService userSettingsService = Ioc . Default . GetService < IUserSettingsService > ( ) ;
448
+ if ( folderPath == CommonPaths . DownloadsPath )
440
449
{
441
450
// Default for downloads folder is to group by date created
442
451
return new LayoutPreferences
0 commit comments