diff options
author | Joe <rbo@gmx.us> | 2023-12-14 20:20:20 +0100 |
---|---|---|
committer | Joe <rbo@gmx.us> | 2023-12-14 20:20:20 +0100 |
commit | 83b9a4f2bba6500ba9155a9b53612b121b4638d7 (patch) | |
tree | c6ac910fccfaf471e744d86092ce22fe7b28df30 | |
parent | up (diff) | |
download | hardflip-83b9a4f2bba6500ba9155a9b53612b121b4638d7.tar.gz hardflip-83b9a4f2bba6500ba9155a9b53612b121b4638d7.tar.bz2 hardflip-83b9a4f2bba6500ba9155a9b53612b121b4638d7.tar.xz hardflip-83b9a4f2bba6500ba9155a9b53612b121b4638d7.tar.zst hardflip-83b9a4f2bba6500ba9155a9b53612b121b4638d7.zip |
reading data dir
Diffstat (limited to '')
-rw-r--r-- | c_init.go | 16 | ||||
-rw-r--r-- | c_josh.go | 2 |
2 files changed, 15 insertions, 3 deletions
@@ -80,8 +80,20 @@ func c_get_data_dir() string { return *ptr } -func c_show_files(dir string) { - if _, err := ioutil.ReadDir(dir); err != nil { +func c_recurse_data_dir(dir string, root string) { + files, err := ioutil.ReadDir(root + dir) + if err != nil { c_die("could not read data directory", err) } + for _, file := range files { + if file.IsDir() == true { + c_recurse_data_dir(dir + file.Name() + "/", root) + } else { + fmt.Println(dir + file.Name()) + } + } +} + +func c_load_data_dir(dir string) { + c_recurse_data_dir("", dir + "/") } @@ -54,5 +54,5 @@ func main() { var data_dir string data_dir = c_get_data_dir() - c_show_files(data_dir) + c_load_data_dir(data_dir) } |