Catch error when creating sync dir fails (#608)

* Catch error when creating the sync dir fails - we cant run if this is not created or present
This commit is contained in:
abraunegg 2019-07-31 07:20:26 +10:00 committed by GitHub
parent 8f71043f23
commit 100e644ae0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -268,7 +268,15 @@ int main(string[] args)
log.vlog("All operations will be performed in: ", syncDir);
if (!exists(syncDir)) {
log.vdebug("syncDir: Configured syncDir is missing. Creating: ", syncDir);
mkdirRecurse(syncDir);
try {
// Attempt to create the sync dir we have been configured with
mkdirRecurse(syncDir);
} catch (std.file.FileException e) {
// Creating the sync directory failed
log.error("ERROR: Unable to create local OneDrive syncDir - ", e.msg);
oneDrive.http.shutdown();
return EXIT_FAILURE;
}
}
chdir(syncDir);