fix: allow notebook to be a hidden dir

pull/401/head
tjex 2 months ago
parent 45b68121ce
commit 202e40c1c7

@ -150,7 +150,8 @@ func (t *indexTask) execute(callback func(change paths.DiffChange)) (NoteIndexin
return false, nil
}
source := paths.Walk(t.path, t.logger, shouldIgnorePath)
notebookPath := &NotebookPath{Path: t.path}
source := paths.Walk(t.path, t.logger, notebookPath.Filename(), shouldIgnorePath)
target, err := t.index.IndexedPaths()
if err != nil {

@ -10,7 +10,7 @@ import (
// Walk emits the metadata of each file stored in the directory if they pass
// the given shouldIgnorePath closure. Hidden files and directories are ignored.
func Walk(basePath string, logger util.Logger, shouldIgnorePath func(string) (bool, error)) <-chan Metadata {
func Walk(basePath string, logger util.Logger, notebookRoot string, shouldIgnorePath func(string) (bool, error)) <-chan Metadata {
c := make(chan Metadata, 50)
go func() {
defer close(c)
@ -22,9 +22,10 @@ func Walk(basePath string, logger util.Logger, shouldIgnorePath func(string) (bo
filename := info.Name()
isHidden := strings.HasPrefix(filename, ".")
isNotebookRoot := filename == notebookRoot
if info.IsDir() {
if isHidden {
if isHidden && !isNotebookRoot {
return filepath.SkipDir
}

Loading…
Cancel
Save