@@ -532,8 +532,8 @@ public static void SetLayoutPreferencesForPath(string path, LayoutPreferencesIte
532
532
return null ;
533
533
534
534
// Port settings to the database, delete the ADS
535
- SetLayoutPreferencesToDatabase ( path , frn , layoutPreferences ) ;
536
- PInvoke . DeleteFileFromApp ( $ "{ path } :files_layoutmode") ;
535
+ if ( SetLayoutPreferencesToDatabase ( path , frn , layoutPreferences ) )
536
+ PInvoke . DeleteFileFromApp ( $ "{ path } :files_layoutmode") ;
537
537
538
538
return layoutPreferences ;
539
539
}
@@ -578,20 +578,23 @@ public static void SetLayoutPreferencesForPath(string path, LayoutPreferencesIte
578
578
}
579
579
}
580
580
581
- private static void SetLayoutPreferencesToDatabase ( string path , ulong ? frn , LayoutPreferencesItem preferencesItem )
581
+ private static bool SetLayoutPreferencesToDatabase ( string path , ulong ? frn , LayoutPreferencesItem preferencesItem )
582
582
{
583
583
if ( string . IsNullOrEmpty ( path ) )
584
- return ;
584
+ return false ;
585
585
586
- var dbInstance = GetDatabaseManagerInstance ( ) ;
587
- if ( dbInstance . GetPreferences ( path , frn ) is null &&
588
- new LayoutPreferencesItem ( ) . Equals ( preferencesItem ) )
586
+ return SafetyExtensions . IgnoreExceptions ( ( ) =>
589
587
{
590
- // Do not create setting if it's default
591
- return ;
592
- }
588
+ var dbInstance = GetDatabaseManagerInstance ( ) ;
589
+ if ( dbInstance . GetPreferences ( path , frn ) is null &&
590
+ new LayoutPreferencesItem ( ) . Equals ( preferencesItem ) )
591
+ {
592
+ // Do not create setting if it's default
593
+ return ;
594
+ }
593
595
594
- dbInstance . SetPreferences ( path , frn , preferencesItem ) ;
596
+ dbInstance . SetPreferences ( path , frn , preferencesItem ) ;
597
+ } ) ;
595
598
}
596
599
597
600
private bool SetProperty < TValue > ( Func < LayoutPreferencesItem , TValue > prop , Action < LayoutPreferencesItem > update , string propertyName )
0 commit comments