Skip to content

Commit

Permalink
Create db path if it does not exist
Browse files Browse the repository at this point in the history
  • Loading branch information
NickM-27 committed May 28, 2022
1 parent 7085fd4 commit c1dd25f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
4 changes: 4 additions & 0 deletions swatch/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,10 @@ def __init_db__(self):
"""Init the Swatch database."""
db_file = os.environ.get("DB_FILE", CONST_DB_FILE)

if not os.path.exists(db_file):
logging.debug(f"{db_file} doesn't exist, creating...")
os.makedirs(db_file)

swatch_db = SqliteExtDatabase(db_file)

router = Router(swatch_db)
Expand Down
1 change: 0 additions & 1 deletion swatch/snapshot.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ def save_snapshot(
if not os.path.exists(file_dir):
logging.debug(f"{file_dir} doesn't exist, creating...")
os.makedirs(file_dir)
return False

file = f"{file_dir}/{file_name}"

Expand Down

0 comments on commit c1dd25f

Please sign in to comment.