Update when application exit message is printed (#2239)

* Update #2229 so that the exit message only appears when --synchronize is actually used
This commit is contained in:
abraunegg 2022-11-25 06:57:30 +11:00 committed by GitHub
parent f853b129cd
commit 87003c5923
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -56,7 +56,7 @@ int main(string[] args)
bool displayMemoryUsage = false; bool displayMemoryUsage = false;
bool displaySyncOptions = false; bool displaySyncOptions = false;
bool cleanupLocalFilesGlobal = false; bool cleanupLocalFilesGlobal = false;
bool monitorConfigured = false; bool synchronizeConfigured = false;
// start and finish messages // start and finish messages
string startMessage = "Starting a sync with OneDrive"; string startMessage = "Starting a sync with OneDrive";
@ -70,7 +70,7 @@ int main(string[] args)
scope(exit) { scope(exit) {
// detail what scope was called // detail what scope was called
log.vdebug("Exit scope called"); log.vdebug("Exit scope called");
if (!monitorConfigured) { if (synchronizeConfigured) {
log.log(finishMessage); log.log(finishMessage);
} }
// Display memory details // Display memory details
@ -835,9 +835,6 @@ int main(string[] args)
} else { } else {
// Running as --monitor // Running as --monitor
log.error("Unable to reach Microsoft OneDrive API service at this point in time, re-trying network tests\n"); log.error("Unable to reach Microsoft OneDrive API service at this point in time, re-trying network tests\n");
// set flag for exit scope
monitorConfigured = true;
// re-try network connection to OneDrive // re-try network connection to OneDrive
// https://github.com/abraunegg/onedrive/issues/1184 // https://github.com/abraunegg/onedrive/issues/1184
// Back off & retry with incremental delay // Back off & retry with incremental delay
@ -1340,6 +1337,9 @@ int main(string[] args)
if (cfg.getValueBool("synchronize")) { if (cfg.getValueBool("synchronize")) {
if (online) { if (online) {
// set flag for exit scope
synchronizeConfigured = true;
// Check user entry for local path - the above chdir means we are already in ~/OneDrive/ thus singleDirectory is local to this path // Check user entry for local path - the above chdir means we are already in ~/OneDrive/ thus singleDirectory is local to this path
if (cfg.getValueString("single_directory") != "") { if (cfg.getValueString("single_directory") != "") {
// Does the directory we want to sync actually exist? // Does the directory we want to sync actually exist?