Add root_dir() and assets_path() to paths module

A few more repo paths.
This commit is contained in:
Eryn Wells 2025-10-06 08:17:11 -07:00
parent 342a4af782
commit 6f8987d393

View file

@ -4,16 +4,33 @@
import os.path as osp
def root_dir() -> str:
'''Return the path to the root of the repository.'''
return osp.normpath(osp.join(osp.dirname(__file__), '..', '..'))
def assets_path() -> str:
'''Return the path to the assets directory.'''
path = osp.join(root_dir(), 'assets')
return path
def content_path() -> str:
'''Return the path to the content directory.'''
path = osp.abspath(osp.join(osp.dirname(__file__), '..', '..', 'content'))
assert osp.isdir(path)
path = osp.join(root_dir(), 'content')
return path
def blog_path() -> str:
'''Return the path to the blog content directory.'''
return osp.join(content_path(), 'blog')
def photos_path() -> str:
'''Return the path to the photos content directory.'''
return osp.join(content_path(), 'photos')
content_dir = content_path
blog_dir = blog_path
photos_dir = photos_path