Commit 539dee31 authored by Pierre-Antoine Rouby's avatar Pierre-Antoine Rouby
Browse files

Config: Fix config dir creation for GNU/Linux.

Showing with 11 additions and 4 deletions
+11 -4
...@@ -242,11 +242,13 @@ class Config(SQL): ...@@ -242,11 +242,13 @@ class Config(SQL):
file = "" file = ""
if os.name == 'posix': if os.name == 'posix':
file = os.path.expanduser('~') + config_dir + config_file ndir = os.path.expanduser('~') + config_dir
else: else:
ndir = os.path.expanduser('~') + config_dir.replace("/", "\\") ndir = os.path.expanduser('~') + config_dir
os.makedirs(ndir, exist_ok = True) ndir = ndir.replace("/", "\\")
file = ndir + config_file
os.makedirs(ndir, exist_ok = True)
file = ndir + config_file
return file return file
......
...@@ -184,6 +184,11 @@ class SQL(object): ...@@ -184,6 +184,11 @@ class SQL(object):
def _init_db_file(self, db): def _init_db_file(self, db):
exists = Path(db).exists() exists = Path(db).exists()
os.makedirs(
os.path.dirname(db),
exist_ok = True
)
self._db = sqlite3.connect(db) self._db = sqlite3.connect(db)
self._cur = self._db.cursor() self._cur = self._db.cursor()
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment