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
|
# pylint: disable=too-few-public-methods
|
||||||
import os
|
from pathlib import Path
|
||||||
import __main__
|
import __main__
|
||||||
|
|
||||||
class DefaultSettings:
|
class DefaultSettings:
|
||||||
|
@ -26,5 +26,4 @@ class DefaultSettings:
|
||||||
'description': 'Support Organizer for FGO'
|
'description': 'Support Organizer for FGO'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
FILE_SAVE_DIRECTORY = Path(__main__.__file__).parent / "temp"
|
||||||
FILE_SAVE_DIRECTORY = f"{os.path.dirname(__main__.__file__)}/temp"
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# pylint: disable=too-few-public-methods
|
# pylint: disable=too-few-public-methods
|
||||||
import os
|
from pathlib import Path
|
||||||
import __main__
|
import __main__
|
||||||
|
|
||||||
class DatabaseSettings:
|
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
|
# pylint: disable=too-few-public-methods
|
||||||
|
|
||||||
import os
|
|
||||||
import dictdatabase as DDB
|
import dictdatabase as DDB
|
||||||
from config.db_settings import DatabaseSettings
|
from config.db_settings import DatabaseSettings
|
||||||
|
|
||||||
|
@ -13,8 +12,8 @@ class Database:
|
||||||
"""
|
"""
|
||||||
__instance = None
|
__instance = None
|
||||||
db = DDB
|
db = DDB
|
||||||
if not os.path.isdir(DatabaseSettings.DATABASE_DIRECTORY):
|
if not DatabaseSettings.DATABASE_DIRECTORY.is_dir():
|
||||||
os.mkdir(DatabaseSettings.DATABASE_DIRECTORY)
|
DatabaseSettings.DATABASE_DIRECTORY.mkdir()
|
||||||
db.config.storage_directory = DatabaseSettings.DATABASE_DIRECTORY
|
db.config.storage_directory = DatabaseSettings.DATABASE_DIRECTORY
|
||||||
if not db.at("requests").exists():
|
if not db.at("requests").exists():
|
||||||
db.at("requests").create({})
|
db.at("requests").create({})
|
||||||
|
|
Loading…
Reference in a new issue