treat config file as site root
This commit is contained in:
parent
c263879904
commit
59ead0f26a
2 changed files with 9 additions and 5 deletions
|
@ -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
0
test/.zona.yml
Normal file
Loading…
Add table
Add a link
Reference in a new issue