mirror of
https://github.com/mealie-recipes/mealie.git
synced 2025-10-27 16:24:31 -04:00
* docs: fix typos * typos: fix typos found by `codespell` across the codebase * docs: fix `macOS` spelling * docs: fix `authentification` terminology "Authentification" is not a thing. * docs: fix `localhost` typo in example link * typos: fix in-code typos These are potentially higher risk, but no other mentions of these typos show up in the codebase.
47 lines
1.3 KiB
Python
47 lines
1.3 KiB
Python
import shutil
|
|
from pathlib import Path
|
|
|
|
from mealie.assets import templates
|
|
|
|
|
|
class AppDirectories:
|
|
def __init__(self, data_dir: Path) -> None:
|
|
self.DATA_DIR = data_dir
|
|
self.BACKUP_DIR = data_dir.joinpath("backups")
|
|
self.USER_DIR = data_dir.joinpath("users")
|
|
self.RECIPE_DATA_DIR = data_dir.joinpath("recipes")
|
|
self.TEMPLATE_DIR = data_dir.joinpath("templates")
|
|
|
|
self.GROUPS_DIR = self.DATA_DIR.joinpath("groups")
|
|
|
|
# Deprecated
|
|
self._TEMP_DIR = data_dir.joinpath(".temp")
|
|
self._IMG_DIR = data_dir.joinpath("img")
|
|
self.ensure_directories()
|
|
|
|
@property
|
|
def IMG_DIR(self):
|
|
return self._IMG_DIR
|
|
|
|
@property
|
|
def TEMP_DIR(self):
|
|
return self._TEMP_DIR
|
|
|
|
def ensure_directories(self):
|
|
required_dirs = [
|
|
self.GROUPS_DIR,
|
|
self.BACKUP_DIR,
|
|
self.TEMPLATE_DIR,
|
|
self.RECIPE_DATA_DIR,
|
|
self.USER_DIR,
|
|
]
|
|
|
|
for dir in required_dirs:
|
|
dir.mkdir(parents=True, exist_ok=True)
|
|
|
|
# Bootstrap Templates
|
|
markdown_template = self.TEMPLATE_DIR.joinpath("recipes.md")
|
|
|
|
if not markdown_template.exists():
|
|
shutil.copyfile(templates.recipes_markdown, markdown_template)
|