Skip to content

Commit

Permalink
Add logging
Browse files Browse the repository at this point in the history
  • Loading branch information
fdennis committed Dec 10, 2024
1 parent a734cde commit cf3c9bd
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/desktop/init.dart
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,8 @@ Future<Widget> initialize(List<String> argv) async {
try {
prefs = await SharedPreferences.getInstance();
} catch (error) {
// Attempt to repair the broken preferences file
_log.warning(
'Failed to load the preferences file. Attempting to repair it.');
Directory appSupportDirectory = await getApplicationSupportDirectory();
String appDataPath =
path.join(appSupportDirectory.path, 'shared_preferences.json');
Expand All @@ -140,7 +141,8 @@ Future<Widget> initialize(List<String> argv) async {
try {
prefs = await SharedPreferences.getInstance();
} catch (error) {
// Unable to repair the preferences file, therefore delete it
_log.warning(
'Failed to repair the preferences file. Deleting the file and proceeding with a fresh configuration.');
await File(appDataPath).delete();
prefs = await SharedPreferences.getInstance();
}
Expand Down

0 comments on commit cf3c9bd

Please sign in to comment.