-
-
Notifications
You must be signed in to change notification settings - Fork 211
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
Bug: tp.file.exists in Obsidian v1.0.0 always returns false for files; #878
Comments
You need to |
I do...it's in the code snippet above. I figured it out. The documentation isn't clear about whether I can pass in just that name of a file, the name+extension, or the fully qualified path relative to the Vault. It's the last one. For example, For a file located at Test/Templater Tests/Test Doc.md :
So I put this into my template and it works:
I hate that I have to hard-code the extension, but I realize most files in Obsidian are markdown. I also don't like hard-coding "/" in either since this may need to change for Obsidian running on Windows. There may be Obsidian utility functions that will abstract this. I suggest updating the documentation to be clearer about what is needed. |
Would you mind opening a PR to do that? |
Of course...I should've thought of that myself. |
Obsidian version 1.0.0, installer build v0.15.8
Templater version 0.11.13
I've tried multiple tests and tp.file.exists returns false for all files. It will return true for a folder.
Here's a test template I created and its output. Note that I've tried other hard-coded file names. I thought using tp.file.title might be the most obvious example of a failure.
Output copied from JS console:
btw, great plugin! It'd be nice to have the file.exists test part of tp.file.create_new as an optional parameter create_if_new.
Jerry
The text was updated successfully, but these errors were encountered: