treat config file as site root

This commit is contained in:
Daniel Fichtinger 2025-04-05 17:17:30 -04:00
parent c263879904
commit 59ead0f26a
2 changed files with 9 additions and 5 deletions

View file

@ -22,17 +22,21 @@ func ChangeExtension(in string, outExt string) string {
return strings.TrimSuffix(in, filepath.Ext(in)) + outExt
}
// TODO: look for .zona.yml instead?
// find the root. check for a .zona.yml first,
// then check if it's cwd.
func getRoot(path string) string {
marker := ".zona.yml"
for {
// fmt.Printf("check for: %s\n", candidate)
parent := filepath.Dir(path)
if parent == "." {
break
candidate := filepath.Join(parent, marker)
if FileExists(candidate) {
return parent
} else if parent == "." {
return path
}
path = parent
}
// fmt.Println("getRoot: ", path)
return path
}
func ReplaceRoot(inPath, outRoot string) string {

0
test/.zona.yml Normal file
View file