mirror of
https://github.com/abraunegg/onedrive
synced 2024-06-01 05:22:14 +02:00
Fix application crash due to access permissions on configured path for sync_dir (#2225)
* Fix application crash due to access permissions on configured path for sync_dir
This commit is contained in:
parent
5a7da61cbb
commit
62859609b7
11
src/main.d
11
src/main.d
|
@ -63,6 +63,8 @@ int main(string[] args)
|
||||||
|
|
||||||
// Define scopes
|
// Define scopes
|
||||||
scope(exit) {
|
scope(exit) {
|
||||||
|
// detail what scope was called
|
||||||
|
log.vdebug("Exit scope called");
|
||||||
// Display memory details
|
// Display memory details
|
||||||
if (displayMemoryUsage) {
|
if (displayMemoryUsage) {
|
||||||
log.displayMemoryUsagePreGC();
|
log.displayMemoryUsagePreGC();
|
||||||
|
@ -92,6 +94,8 @@ int main(string[] args)
|
||||||
}
|
}
|
||||||
|
|
||||||
scope(failure) {
|
scope(failure) {
|
||||||
|
// detail what scope was called
|
||||||
|
log.vdebug("Failure scope called");
|
||||||
// Display memory details
|
// Display memory details
|
||||||
if (displayMemoryUsage) {
|
if (displayMemoryUsage) {
|
||||||
log.displayMemoryUsagePreGC();
|
log.displayMemoryUsagePreGC();
|
||||||
|
@ -978,6 +982,7 @@ int main(string[] args)
|
||||||
|
|
||||||
// configure the sync direcory based on syncDir config option
|
// configure the sync direcory based on syncDir config option
|
||||||
log.vlog("All operations will be performed in: ", syncDir);
|
log.vlog("All operations will be performed in: ", syncDir);
|
||||||
|
try {
|
||||||
if (!exists(syncDir)) {
|
if (!exists(syncDir)) {
|
||||||
log.vdebug("syncDir: Configured syncDir is missing. Creating: ", syncDir);
|
log.vdebug("syncDir: Configured syncDir is missing. Creating: ", syncDir);
|
||||||
try {
|
try {
|
||||||
|
@ -993,6 +998,12 @@ int main(string[] args)
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} catch (std.file.FileException e) {
|
||||||
|
// Creating the sync directory failed
|
||||||
|
log.error("ERROR: Unable to test the configured OneDrive syncDir - ", e.msg);
|
||||||
|
// Use exit scopes to shutdown API
|
||||||
|
return EXIT_FAILURE;
|
||||||
|
}
|
||||||
|
|
||||||
// Change the working directory to the 'sync_dir' configured item
|
// Change the working directory to the 'sync_dir' configured item
|
||||||
chdir(syncDir);
|
chdir(syncDir);
|
||||||
|
|
Loading…
Reference in a new issue