Handle case where documents path changes

It seems sometimes when an app is updated their documents path changes.
So our cached version of it is now incorrect and needs to be refreshed -

Fixes #159
This commit is contained in:
Vishesh Handa
2020-06-09 17:44:04 +02:00
parent eb37ae592c
commit 9cb810f41d
2 changed files with 9 additions and 0 deletions

View File

@ -59,6 +59,14 @@ class JournalApp extends StatefulWidget {
appState.save(pref);
}
if (!Directory(appState.gitBaseDirectory).existsSync()) {
Log.w("Applications Documents Directory no longer exists");
var dir = await getApplicationDocumentsDirectory();
appState.gitBaseDirectory = dir.path;
appState.save(pref);
Log.i("New Documents Directory Path ${dir.path}");
}
if (appState.localGitRepoConfigured == false) {
// FIXME: What about exceptions!
appState.localGitRepoFolderName = "journal_local";

View File

@ -55,6 +55,7 @@ class AppState {
Log.i("localGitRepoFolderName: $localGitRepoFolderName");
Log.i("remoteGitRepoFolderName: $remoteGitRepoFolderName");
Log.i("onBoardingCompleted: $onBoardingCompleted");
Log.i("gitBaseDirectory: $gitBaseDirectory");
Log.i(" ------------------ ");
}