mirror of
https://github.com/abraunegg/onedrive
synced 2024-05-02 22:13:16 +02:00
Update database access exclusivity test for --resync (#2155)
* Update database access exclusivity test for --resync
This commit is contained in:
parent
e2ed2d2b58
commit
a35c7c72f5
13
src/main.d
13
src/main.d
|
@ -789,8 +789,19 @@ int main(string[] args)
|
|||
log.vdebug("Testing if we have exclusive access to local database file");
|
||||
// Are we the only running instance? Test that we can open the database file path
|
||||
itemDb = new ItemDatabase(cfg.databaseFilePath);
|
||||
destroy(itemDb);
|
||||
|
||||
// did we successfully initialise the database class?
|
||||
if (!itemDb.isDatabaseInitialised()) {
|
||||
// no .. destroy class
|
||||
itemDb = null;
|
||||
// exit application
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
// If we have exclusive access we will not have exited
|
||||
// destroy access test
|
||||
destroy(itemDb);
|
||||
// delete application sync state
|
||||
log.log("Deleting the saved application sync status ...");
|
||||
if (!cfg.getValueBool("dry_run")) {
|
||||
safeRemove(cfg.databaseFilePath);
|
||||
|
|
Loading…
Reference in a new issue