added proper output directory structure
This commit is contained in:
parent
fdb8753538
commit
988d4ba42e
3 changed files with 52 additions and 1 deletions
|
@ -22,6 +22,7 @@ func ChangeExtension(in string, outExt string) string {
|
|||
return strings.TrimSuffix(in, filepath.Ext(in)) + outExt
|
||||
}
|
||||
|
||||
// TODO: look for .zona.yml instead?
|
||||
func getRoot(path string) string {
|
||||
for {
|
||||
parent := filepath.Dir(path)
|
||||
|
@ -40,6 +41,19 @@ func ReplaceRoot(inPath, outRoot string) string {
|
|||
return outPath
|
||||
}
|
||||
|
||||
// Indexify converts format path/file.ext
|
||||
// into path/file/index.ext
|
||||
func Indexify(in string) string {
|
||||
ext := filepath.Ext(in)
|
||||
trimmed := strings.TrimSuffix(in, ext)
|
||||
filename := filepath.Base(trimmed)
|
||||
if filename == "index" {
|
||||
return in
|
||||
}
|
||||
prefix := strings.TrimSuffix(trimmed, filename)
|
||||
return filepath.Join(prefix, filename, "index"+ext)
|
||||
}
|
||||
|
||||
// InDir checks whether checkPath is
|
||||
// inside targDir.
|
||||
func InDir(checkPath string, targDir string) bool {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue