Skip to content

Commit c1dd25f

Browse files
committed
Create db path if it does not exist
1 parent 7085fd4 commit c1dd25f

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

swatch/app.py

+4
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,10 @@ def __init_db__(self):
6060
"""Init the Swatch database."""
6161
db_file = os.environ.get("DB_FILE", CONST_DB_FILE)
6262

63+
if not os.path.exists(db_file):
64+
logging.debug(f"{db_file} doesn't exist, creating...")
65+
os.makedirs(db_file)
66+
6367
swatch_db = SqliteExtDatabase(db_file)
6468

6569
router = Router(swatch_db)

swatch/snapshot.py

-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@ def save_snapshot(
5454
if not os.path.exists(file_dir):
5555
logging.debug(f"{file_dir} doesn't exist, creating...")
5656
os.makedirs(file_dir)
57-
return False
5857

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

0 commit comments

Comments
 (0)