Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RcFile: _read: try taskrc directory when trying to load includes #170

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

RaitoBezarius
Copy link

Taskwarrior itself tries includes as absolute path, then cwd, then relative to rcfile, then in various search paths (see GothenburgBitFactory/libshared -> src/Configuration.cpp -> Configuration::parse()).

We won't try to duplicate that whole arrangement here, but at least look relative to the rcfile in addition to cwd/absolute, like taskwarrior does. This will allow specification as relative path in most cases. Otherwise, we'd have to chdir anyways because includes are always tried as-is by taskw. They would only work if specified as absolute paths or if in cwd

We use a TaskRc() class variable to store the rcdir because there could be an include chain and all the instances will need to know the same one, but will be processing different paths, so we have to capture the directory of the first one processed, ie the base rcfile.

Fixes #150

Taskwarrior itself tries includes as absolute path, then cwd, then
relative to rcfile, then in various search paths (see
GothenburgBitFactory/libshared -> src/Configuration.cpp ->
Configuration::parse()).

We won't try to duplicate that whole arrangement here, but at least look
relative to the rcfile in addition to cwd/absolute, like taskwarrior
does.  This will allow specification as relative path in most cases.
Otherwise, we'd have to chdir anyways because includes are always tried
as-is by taskw.  They would only work if specified as absolute paths or
if in cwd

We use a TaskRc() class variable to store the rcdir because there could
be an include chain and all the instances will need to know the same
one, but will be processing different paths, so we have to capture the
directory of the first one processed, ie the base rcfile.

Fixes ralphbean#150

Co-authored-by: Raito Bezarius <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

taskrc includes as relative paths cause FileNotFoundError in taskw
2 participants