Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
resolves: #271
The
index
function ofzk
calls a directory walk. That walk function was set to ignore all directories and files that had a period as a prefix. This applied then to the notebook root directory itself. This also effected commands such aszk list
.This fix is an initial approach to solving that by checking if the directory begins with a prefix and the directory in question does not equal the notebook root directory.
This equality check is done by getting the notebook directory from the
NotebookPath.Filename()
method, and checking it against the value offilename
ininternal/util/paths/walk.go
.Note: It was not possible to import the
core
package towalk.go
as it created an import cycle. This is why it is instead accessed ininternal/core/note_index.go
line 153 and passed to thepaths.Walk()
call.On that line (153), I'm unsure whether I've used the
NotebookPath
struct correctly as in other areas of the code base, all fields of the struct are declared.I have however tested this fix with success. That being a notebook with root dir
.test-vault
;zk
indexes and lists correctly, meaning it ignores the.zk
and.git
directories as well as a.test-file.md
note created viazk
.Please let me know if there is a better way to do this! 🙏