Skip to content

Commit

Permalink
fix(toc): consider windows file paths
Browse files Browse the repository at this point in the history
  • Loading branch information
enricoschuetz committed Nov 28, 2023
1 parent 50f7f65 commit 1c094b2
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion internal/toc/toc.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"fmt"
"log/slog"
"os"
"path"
"path/filepath"
"strings"
"time"
Expand Down Expand Up @@ -46,6 +47,8 @@ func Create(rootPath string) error {
}
// rootPath/relPath provided by walker, can ignore error
relPath, _ := filepath.Rel(rootPath, absPath)
//TODO: check if slashes are handled correctly (consider windows paths)
relPath = filepath.ToSlash(relPath)
err = insert(relPath, &newTOC, thingMeta)
if err != nil {
log.Error(fmt.Sprintf("Failed to insert %s into toc:", absPath))
Expand Down Expand Up @@ -105,7 +108,8 @@ func insert(relPath string, toc *model.TOC, ctm model.CatalogThingModel) error {
if err != nil {
return err
}
name := filepath.Dir(relPath)
//TODO: check if slashes are handled correctly (consider windows paths)
name := path.Dir(relPath)
tocEntry := toc.FindByName(name)
// TODO: provide copy method for CatalogThingModel in TocThing
if tocEntry == nil {
Expand Down

0 comments on commit 1c094b2

Please sign in to comment.