Our project code is always organized in a git-repo and it would be nice if we can store paths (e.g. in config files) as relative paths to the git-root directory.
For example:
project_git_repo is located at: /home/tibuch/Gitrepos/project_git_repo
A data file is located at: /home/tibuch/Data/img.tif
In the config file we don't want the full path, but the relative path ../../Data/img.tif. To make this pattern easy we should add two methods:
make_relative_to_git_root(path: Path) -> Path
resolve_with_git_root(path: Path) -> Path
This would allow us to convert any path during the config file generation to a relative path and in the processing scripts we can convert them back to absolute paths.
Our project code is always organized in a git-repo and it would be nice if we can store paths (e.g. in config files) as relative paths to the git-root directory.
For example:
/home/tibuch/Gitrepos/project_git_repo
/home/tibuch/Data/img.tif
In the config file we don't want the full path, but the relative path
../../Data/img.tif
. To make this pattern easy we should add two methods:make_relative_to_git_root(path: Path) -> Path
resolve_with_git_root(path: Path) -> Path
This would allow us to convert any path during the config file generation to a relative path and in the processing scripts we can convert them back to absolute paths.