fixed node.root
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Sebastian Frank 2019-03-19 10:38:48 +01:00
parent 938e597f3f
commit dfc932b7b0
Signed by: apairon
GPG Key ID: 7270D06DDA7FE8C3
2 changed files with 6 additions and 4 deletions

View File

@ -16,6 +16,10 @@ import (
// ReadContentDir walks through content directory and builds the tree of configurations
func (node *TreeNode) ReadContentDir(inBase string, outBase string, dir string, conf *PathConfig) {
if node.root == nil {
// first node is root
node.root = node
}
node.fillConfig(inBase, outBase, dir, conf)
files, err := ioutil.ReadDir(node.InputPath)
@ -51,6 +55,7 @@ func (node *TreeNode) ReadContentDir(inBase string, outBase string, dir string,
if f.IsDir() {
helper.Log.Debugf("DIR %s", p)
newTree := new(TreeNode)
newTree.root = node.root
if node.Sub == nil {
node.Sub = make([]*TreeNode, 0)
}

View File

@ -154,10 +154,6 @@ func (node *TreeNode) handleCollections() {
}
func (node *TreeNode) fillConfig(inBase, outBase, dir string, conf *PathConfig) {
if node.root == nil {
// this must be root
node.root = node
}
inPath := inBase
if dir != "" {
inPath += "/" + dir
@ -229,6 +225,7 @@ func (node *TreeNode) fillConfig(inBase, outBase, dir string, conf *PathConfig)
func Add2Nav(currentNode *TreeNode, pathConfig *PathConfig, tplFilename, outDir string, navname string, ctx interface{}, dataMapKey string, body string, hidden bool) {
newNode := new(TreeNode)
newNode.root = currentNode.root
newNode.fillConfig(
currentNode.InputPath,
currentNode.OutputPath,