Make sure local git repo always exists

There are some cases when upgrading from a really old version that the
journal_local no longer exists.
This commit is contained in:
Vishesh Handa
2020-07-21 11:19:27 +02:00
parent 5d7f616c6e
commit 42d755be1d

View File

@ -71,7 +71,21 @@ class JournalApp extends StatefulWidget {
Log.i("New Documents Directory Path ${dir.path}");
}
if (appState.localGitRepoConfigured == false) {
// Handle migrations - Remove this code in 2021
var localConfigured = appState.localGitRepoConfigured;
if (localConfigured && appState.remoteGitRepoConfigured == false) {
appState.localGitRepoFolderName = "journal_local";
var repoPath = p.join(
appState.gitBaseDirectory,
appState.localGitRepoFolderName,
);
if (!Directory(repoPath).existsSync()) {
localConfigured = false;
}
}
if (localConfigured == false) {
// FIXME: What about exceptions!
appState.localGitRepoFolderName = "journal_local";
var repoPath = p.join(