Migrate hyphae

This commit is contained in:
Timur Ismagilov 2024-09-07 22:41:24 +03:00
parent 6fce1e7750
commit 191c18fd9e
2 changed files with 7 additions and 5 deletions

View File

@ -1,9 +1,10 @@
package hyphae
import (
"github.com/bouncepaw/mycorrhiza/util"
"os"
"path/filepath"
"github.com/bouncepaw/mycorrhiza/util"
)
// ExistingHypha is not EmptyHypha. *MediaHypha and *TextualHypha implement this interface.

View File

@ -1,11 +1,11 @@
package hyphae
import (
"github.com/bouncepaw/mycorrhiza/internal/mimetype"
"log"
"log/slog"
"os"
"path/filepath"
"github.com/bouncepaw/mycorrhiza/internal/mimetype"
)
// Index finds all hypha files in the full `path` and saves them to the hypha storage.
@ -51,7 +51,7 @@ func Index(path string) {
}
}
}
log.Println("Indexed", Count(), "hyphae")
slog.Info("Indexed hyphae", "n", Count())
}
// indexHelper finds all hypha files in the full `path` and sends them to the
@ -60,7 +60,8 @@ func Index(path string) {
func indexHelper(path string, nestLevel uint, ch chan ExistingHypha) {
nodes, err := os.ReadDir(path)
if err != nil {
log.Fatal(err)
slog.Error("Failed to read directory", "path", path, "err", err)
os.Exit(1)
}
for _, node := range nodes {