From 83b9a4f2bba6500ba9155a9b53612b121b4638d7 Mon Sep 17 00:00:00 2001 From: Joe Date: Thu, 14 Dec 2023 20:20:20 +0100 Subject: reading data dir --- c_init.go | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'c_init.go') diff --git a/c_init.go b/c_init.go index 894b6c3..9f44207 100644 --- a/c_init.go +++ b/c_init.go @@ -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 + "/") } -- cgit v1.2.3