def get_project_root():
""" Return the common base-directory for projects.
This allows you to specify a `--project` on the command-line
and to reference a project directory off of this root without adding
a mapping in the `projects` section of the user configuration file.
The value for this comes from a `root` symlink in the `--user-config`
directory. If this is a file, instead of a directory, it needs to
be the name of the directory. (It does '~' expansion.)
The expectation is that this will allow a common `~/BittyProjects`
or `~/Documents/BittyTunes` directory to root your projects.
"""
global home_dir
root = home_dir / "root"
if root.is_file():
t = root.read_text().strip()
root = Path(t).expanduser()
if root.is_dir():
return root.resolve()
return None
评论列表
文章目录