diff options
| author | Joe <rbo@gmx.us> | 2023-12-26 20:20:20 +0100 | 
|---|---|---|
| committer | Joe <rbo@gmx.us> | 2023-12-26 20:20:20 +0100 | 
| commit | 19956757cf0136fb7389a9dfd86481b5d1e4c194 (patch) | |
| tree | fc92c13169808781a2ede84d567abdcc8e72acae | |
| parent | up (diff) | |
| download | hardflip-19956757cf0136fb7389a9dfd86481b5d1e4c194.tar.gz hardflip-19956757cf0136fb7389a9dfd86481b5d1e4c194.tar.bz2 hardflip-19956757cf0136fb7389a9dfd86481b5d1e4c194.tar.xz hardflip-19956757cf0136fb7389a9dfd86481b5d1e4c194.tar.zst hardflip-19956757cf0136fb7389a9dfd86481b5d1e4c194.zip | |
thats all folks
Diffstat (limited to '')
| -rw-r--r-- | c_init.go | 11 | 
1 files changed, 7 insertions, 4 deletions
| @@ -60,26 +60,27 @@ type HardOpts struct {  // this function recurses into the specified root directory in order to load  // every yaml file into memory  func c_recurse_data_dir(dir, root string, ldirs *DirsList, -		id uint64, name string, parent *DirsNode, depth uint16) { +		id *uint64, name string, parent *DirsNode, depth uint16) {  	files, err := os.ReadDir(root + dir)  	if err != nil {  		c_die("could not read data directory", err)  	}  	dir_node := DirsNode{  		// TODO - ID wrong - how do i static in go -		id, +		*id,  		name,  		parent,  		depth,  		&HostList{},  		nil,  	} +	*id++  	ldirs.add_back(&dir_node)  	for _, file := range files {  		filename := file.Name()  		if file.IsDir() == true {  			c_recurse_data_dir(dir + filename + "/", root, ldirs, -				id + 1, file.Name(), &dir_node, depth + 1) +				id, file.Name(), &dir_node, depth + 1)  		} else if filepath.Ext(filename) == ".yml" {  			host := c_read_yaml_file(root + dir + filename)  			if host == nil { @@ -94,7 +95,9 @@ func c_recurse_data_dir(dir, root string, ldirs *DirsList,  func c_load_data_dir(dir string) *DirsList {  	ldirs := DirsList{} +	var id uint64 -	c_recurse_data_dir("", dir + "/", &ldirs, 0, "", nil, 0) +	id = 0 +	c_recurse_data_dir("", dir + "/", &ldirs, &id, "", nil, 0)  	return &ldirs  } | 
