2023-07-17 19:57:34 +01:00
|
|
|
# Crown Owned Copyright (C) Dstl 2023. DEFCON 703. Shared in confidence.
|
2023-07-18 10:21:06 +01:00
|
|
|
from logging import Logger
|
2023-07-14 12:01:38 +01:00
|
|
|
|
2023-06-30 09:08:13 +01:00
|
|
|
from primaite import _USER_DIRS, getLogger, LOG_DIR, NOTEBOOKS_DIR
|
2023-06-07 22:40:16 +01:00
|
|
|
|
2023-07-18 10:21:06 +01:00
|
|
|
_LOGGER: Logger = getLogger(__name__)
|
2023-06-07 22:40:16 +01:00
|
|
|
|
|
|
|
|
|
2023-07-14 12:01:38 +01:00
|
|
|
def run() -> None:
|
2023-06-07 22:40:16 +01:00
|
|
|
"""
|
|
|
|
|
Handles creation of application directories and user directories.
|
|
|
|
|
|
|
|
|
|
Uses `platformdirs.PlatformDirs` and `pathlib.Path` to create the required
|
|
|
|
|
app directories in the correct locations based on the users OS.
|
|
|
|
|
"""
|
|
|
|
|
app_dirs = [
|
|
|
|
|
_USER_DIRS,
|
|
|
|
|
NOTEBOOKS_DIR,
|
|
|
|
|
LOG_DIR,
|
|
|
|
|
]
|
|
|
|
|
|
|
|
|
|
for app_dir in app_dirs:
|
|
|
|
|
if not app_dir.is_dir():
|
|
|
|
|
app_dir.mkdir(parents=True, exist_ok=True)
|
|
|
|
|
_LOGGER.info(f"Created directory: {app_dir}")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ == "__main__":
|
|
|
|
|
run()
|