save_variables: Verify filename path is writeable at startup

Signed-off-by: Justin Schuh <code@justinschuh.com>
This commit is contained in:
Justin Schuh 2022-12-05 15:29:31 -08:00 committed by KevinOConnor
parent ba365aff96
commit 201f715b55
1 changed files with 2 additions and 0 deletions

View File

@ -12,6 +12,8 @@ class SaveVariables:
self.filename = os.path.expanduser(config.get('filename'))
self.allVariables = {}
try:
if not os.path.exists(self.filename):
open(self.filename, "w").close()
self.loadVariables()
except self.printer.command_error as e:
raise config.error(str(e))