fixed traversal constructing output paths correctly
This commit is contained in:
parent
c81985e79a
commit
005f011678
2 changed files with 3 additions and 2 deletions
|
@ -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())
|
||||||
}
|
}
|
||||||
|
|
|
@ -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
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue