merge: import notif-vault sources with history
git-subtree-dir: notif-vault git-subtree-mainline:e3622e32d6git-subtree-split:050d43c2b9
This commit is contained in:
commit
19f84c6463
8 files changed
+386
No files matched your search
@@ -0,0 +1,25 @@
|
||||
import json
|
||||
import os
|
||||
from pathlib import Path
|
||||
|
||||
configDir = Path.home() / ".config" / "notif-vault"
|
||||
configPath = configDir / "config.json"
|
||||
defaultConfigPath = Path(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) / "config.default.json"
|
||||
|
||||
|
||||
def loadConfig():
|
||||
if configPath.exists():
|
||||
with open(configPath) as f:
|
||||
return json.load(f)
|
||||
with open(defaultConfigPath) as f:
|
||||
return json.load(f)
|
||||
|
||||
|
||||
def ensureUserConfig():
|
||||
if configPath.exists():
|
||||
return
|
||||
configDir.mkdir(parents=True, exist_ok=True)
|
||||
with open(defaultConfigPath) as f:
|
||||
default = f.read()
|
||||
with open(configPath, "w") as f:
|
||||
f.write(default)
|
||||
Reference in new issue
Block a user