summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/config.py18
1 files changed, 13 insertions, 5 deletions
diff --git a/src/config.py b/src/config.py
index 2c80716..468718a 100644
--- a/src/config.py
+++ b/src/config.py
@@ -11,17 +11,25 @@ import src.globals as Globals
class Config():
def __init__(self):
- self.config_path = os.path.join(
- os.path.expanduser("~"),
- ".config",
- "assignment-list-pyqt5",
- "config")
+ self.config_path = self.getConfigPath()
if not os.path.exists(self.config_path):
self.createConfig()
self.loadConfig()
+ def getConfigPath(self):
+ if sys.platform.startswith("win32"):
+ return os.path.join(os.path.expandvars("$APPDATA"),
+ "assignment-list-pyqt5",
+ "config")
+ else:
+ return os.path.join(
+ os.path.expanduser("~"),
+ ".config",
+ "assignment-list-pyqt5",
+ "config")
+
def loadConfig(self):
self.config = configparser.ConfigParser()