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 b17725a
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,16 +131,18 @@ Future<Widget> initialize(List<String> argv) async {
try {
prefs = await SharedPreferences.getInstance();
} catch (error) {
// Attempt to repair the broken preferences file
Directory appSupportDirectory = await getApplicationSupportDirectory();
String appDataPath =
path.join(appSupportDirectory.path, 'shared_preferences.json');
_log.warning(
'Failed to load the preferences file at $appDataPath. Attempting to repair it.');
await _repairPreferences(appDataPath);

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 b17725a

Please sign in to comment.