generate_folder() has incorrect relative
logic vs generate_path()
#1446
Labels
bug
Something isn't working
relative
logic vs generate_path()
#1446
Plugin information (please complete the following information):
Describe the bug
The docs and code for
tp.file.folder(relative=false)
are misleading/incorrect.folder()
returns a file-relative folder forrelative=false
and a vault-absolute path forrelative=true
.This caused some weirdness in my Templated notes where:
The above snippet is imported/used/shared by multiple templates, so the
folder()
call is quite important./The issue is quite obvious when you compare
folder()
andfile()
code:Expected behaviour
relative=true
to return Note-relative folder paths, andrelative=false
to return vault-absolute paths.Screenshots
n/a
Additional context
Changing or "fixing" the behaviour of the
folder()
API would break back-compat and be a maintenance nightmare, but renaming the value and updating the docs would only affect the docs and improve clarity. However, whilst that is a best-fit for effort/reward, the API itself would be more inconsistent. One possible, and more professional option might be to create a new functiondirname()
(which would matchpathlib
and be less 'surprising' overall, or something better?) and deprecatefolder()
, but is it worth the effort?The text was updated successfully, but these errors were encountered: