From ac02b768d3cb771f7698dfc67bb1bd9022843ded Mon Sep 17 00:00:00 2001 From: abraunegg Date: Fri, 13 Nov 2020 07:34:52 +1100 Subject: [PATCH] catch folder creation errors due to file system permissions error * catch folder creation errors due to file system permissions error --- src/onedrive.d | 8 +++++++- src/sync.d | 13 +++++++++---- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/src/onedrive.d b/src/onedrive.d index 467cfbe8..baf31487 100644 --- a/src/onedrive.d +++ b/src/onedrive.d @@ -506,7 +506,13 @@ final class OneDriveApi // Create the directory string newPath = dirName(saveToPath); - mkdirRecurse(newPath); + try { + mkdirRecurse(newPath); + } catch (FileException e) { + // display the error message + displayFileSystemErrorMessage(e.msg); + } + // Configure the applicable permissions for the folder newPath.setAttributes(cfg.returnRequiredDirectoryPermisions()); const(char)[] url = driveByIdUrl ~ driveId ~ "/items/" ~ id ~ "/content?AVOverride=1"; diff --git a/src/sync.d b/src/sync.d index 012600dc..30768ef0 100644 --- a/src/sync.d +++ b/src/sync.d @@ -2423,10 +2423,15 @@ final class SyncEngine } if (!dryRun) { - // Create the new directory - mkdirRecurse(path); - // Configure the applicable permissions for the folder - path.setAttributes(cfg.returnRequiredDirectoryPermisions()); + try { + // Create the new directory + mkdirRecurse(path); + // Configure the applicable permissions for the folder + path.setAttributes(cfg.returnRequiredDirectoryPermisions()); + } catch (FileException e) { + // display the error message + displayFileSystemErrorMessage(e.msg); + } } else { // we dont create the directory, but we need to track that we 'faked it' idsFaked ~= [item.driveId, item.id];