From c7e6a2d53e4095a950801c34596729d93b42e37d Mon Sep 17 00:00:00 2001 From: Olivier Keshavjee Date: Sun, 15 Oct 2017 21:39:36 +0200 Subject: [PATCH] Fixes again: Crash when permissions don't allow saving #138 --- manuskript/load_save/version_1.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/manuskript/load_save/version_1.py b/manuskript/load_save/version_1.py index df059db..c255281 100644 --- a/manuskript/load_save/version_1.py +++ b/manuskript/load_save/version_1.py @@ -296,7 +296,10 @@ def saveProject(zip=None): project = mw.currentProject - if not os.access(project, os.W_OK): + # We check if the file exist and we have write access. If the file does + # not exists, we check the parent folder, because it might be a new project. + if os.path.exists(project) and not os.access(project, os.W_OK) or \ + not os.path.exists(project) and not os.access(os.path.dirname(project), os.W_OK): print("Error: you don't have write access to save this project there.") return False