- added Exception handing for the case when the user is trying to save & overwrite a file already opened in another file

This commit is contained in:
Marius Stanciu
2019-08-09 22:39:13 +03:00
parent 7a6c0541be
commit 6f526acb4d
5 changed files with 87 additions and 25 deletions

View File

@@ -5887,12 +5887,15 @@ class FlatCAMCNCjob(FlatCAMObj, CNCjob):
with open(filename, 'w') as f:
for line in lines:
f.write(line)
except FileNotFoundError:
self.app.inform.emit(_(
"[WARNING_NOTCL] No such file or directory"
))
return
except PermissionError:
self.app.inform.emit(_("[WARNING] Permission denied, saving not possible.\n"
"Most likely another app is holding the file open and not accessible."))
return 'fail'
elif to_file is False:
# Just for adding it to the recent files list.
if self.app.defaults["global_open_style"] is False: