Skip to content

Commit

Permalink
Fixed tags on windows (#1646)
Browse files Browse the repository at this point in the history
* Fixed tags on windows

* Use the variable text directly in error message
  • Loading branch information
Catalyn45 authored Mar 17, 2024
1 parent d2136df commit 4b076d1
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions nav.go
Original file line number Diff line number Diff line change
Expand Up @@ -1926,10 +1926,15 @@ func (nav *nav) readTags() error {

scanner := bufio.NewScanner(f)
for scanner.Scan() {
path, tag, found := strings.Cut(scanner.Text(), ":")
if !found {
return fmt.Errorf("invalid tags file entry: %s", scanner.Text())
text := scanner.Text()

ind := strings.LastIndex(text, ":")
if ind == -1 {
return fmt.Errorf("invalid tags file entry: %s", text)
}

path := text[0:ind]
tag := text[ind+1:]
if _, ok := nav.tags[path]; !ok {
nav.tags[path] = tag
}
Expand Down

0 comments on commit 4b076d1

Please sign in to comment.