aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--c_init.go16
-rw-r--r--c_josh.go2
2 files changed, 15 insertions, 3 deletions
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 + "/")
}
diff --git a/c_josh.go b/c_josh.go
index ad61793..740b237 100644
--- a/c_josh.go
+++ b/c_josh.go
@@ -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)
}