Skip to content

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]>
@smemsh
Copy link

smemsh commented Aug 26, 2025

You may want to mention why it's better than #151 (for whoever reviews it in 10 years ;-) and also maybe change the title slightly, since it's identical. Just to disambiguate...

@smemsh
Copy link

smemsh commented Aug 26, 2025

On second thought, since I don't use this library anymore and you are still active, it makes more sense for you to maintain it. I've marked mine as superseded. But it might be good for others to briefly note why this one is better in any case. Thanks!

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