fixed traversal constructing output paths correctly

This commit is contained in:
Daniel Fichtinger 2024-11-12 00:48:10 -05:00
parent c81985e79a
commit 005f011678
2 changed files with 3 additions and 2 deletions

View file

@ -46,7 +46,7 @@ func main() {
// os.Exit(1) // os.Exit(1)
// } // }
// convert.ConvertFile(*mdPath, "test/test.html") // convert.ConvertFile(*mdPath, "test/test.html")
err := util.Traverse("test", "foobar") err := util.Traverse(*mdPath, "foobar")
if err != nil { if err != nil {
fmt.Printf("Error: %s\n", err.Error()) fmt.Printf("Error: %s\n", err.Error())
} }

View file

@ -36,11 +36,12 @@ func PathIsValid(path string, requireFile bool) bool {
func getRoot(path string) string { func getRoot(path string) string {
for { for {
parent := filepath.Dir(path) parent := filepath.Dir(path)
if parent == path { if parent == "." {
break break
} }
path = parent path = parent
} }
fmt.Println("getRoot: ", path)
return path return path
} }