moved from os to pathlib
This commit is contained in:
parent
6713d4658b
commit
a8bc73c532
3 changed files with 6 additions and 8 deletions
|
@ -1,5 +1,5 @@
|
|||
# pylint: disable=too-few-public-methods
|
||||
import os
|
||||
from pathlib import Path
|
||||
import __main__
|
||||
|
||||
class DefaultSettings:
|
||||
|
@ -26,5 +26,4 @@ class DefaultSettings:
|
|||
'description': 'Support Organizer for FGO'
|
||||
}
|
||||
}
|
||||
|
||||
FILE_SAVE_DIRECTORY = f"{os.path.dirname(__main__.__file__)}/temp"
|
||||
FILE_SAVE_DIRECTORY = Path(__main__.__file__).parent / "temp"
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# pylint: disable=too-few-public-methods
|
||||
import os
|
||||
from pathlib import Path
|
||||
import __main__
|
||||
|
||||
class DatabaseSettings:
|
||||
DATABASE_DIRECTORY = f"{os.path.dirname(__main__.__file__)}/database/storage"
|
||||
DATABASE_DIRECTORY = Path(__main__.__file__).parent / "database/storage"
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
# pylint: disable=too-few-public-methods
|
||||
|
||||
import os
|
||||
import dictdatabase as DDB
|
||||
from config.db_settings import DatabaseSettings
|
||||
|
||||
|
@ -13,8 +12,8 @@ class Database:
|
|||
"""
|
||||
__instance = None
|
||||
db = DDB
|
||||
if not os.path.isdir(DatabaseSettings.DATABASE_DIRECTORY):
|
||||
os.mkdir(DatabaseSettings.DATABASE_DIRECTORY)
|
||||
if not DatabaseSettings.DATABASE_DIRECTORY.is_dir():
|
||||
DatabaseSettings.DATABASE_DIRECTORY.mkdir()
|
||||
db.config.storage_directory = DatabaseSettings.DATABASE_DIRECTORY
|
||||
if not db.at("requests").exists():
|
||||
db.at("requests").create({})
|
||||
|
|
Loading…
Reference in a new issue