Add root_dir() and assets_path() to paths module
A few more repo paths.
This commit is contained in:
parent
342a4af782
commit
6f8987d393
1 changed files with 19 additions and 2 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue