From 6fb3931488c7242fa2af076255f8356838b91c70 Mon Sep 17 00:00:00 2001 From: Jonathan Harris Date: Wed, 3 Jun 2015 23:58:59 +0100 Subject: [PATCH] Remember output folder on Windows. --- config.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/config.py b/config.py index 8b1fc466..e3e5f39c 100644 --- a/config.py +++ b/config.py @@ -62,12 +62,10 @@ class Config: mkdir(self.app_dir) self.handle = _winreg.CreateKey(_winreg.HKEY_CURRENT_USER, r'Software\%s' % appname) - try: - if not isdir(_winreg.QueryValue(self.handle, 'outdir')): - raise Exception() - except: + + if not self.read('outdir') or not isdir(self.read('outdir')): ctypes.windll.shell32.SHGetSpecialFolderPathW(0, buf, CSIDL_PERSONAL, 0) - _winreg.SetValueEx(self.handle, 'outdir', 0, _winreg.REG_SZ, buf.value) + self.write('outdir', buf.value) def read(self, key): try: