processDir processes recursively all shaders files in the specified directory
(dir string, include bool)
| 149 | |
| 150 | // processDir processes recursively all shaders files in the specified directory |
| 151 | func processDir(dir string, include bool) { |
| 152 | |
| 153 | // Open directory to process |
| 154 | f, err := os.Open(dir) |
| 155 | if err != nil { |
| 156 | panic(err) |
| 157 | } |
| 158 | defer f.Close() |
| 159 | |
| 160 | // Read all file entries from the directory |
| 161 | finfos, err := f.Readdir(0) |
| 162 | if err != nil { |
| 163 | panic(err) |
| 164 | } |
| 165 | |
| 166 | // Process all directory entries. |
| 167 | for _, fi := range finfos { |
| 168 | if fi.IsDir() { |
| 169 | dirInclude := include |
| 170 | if fi.Name() == DIR_INCLUDE { |
| 171 | dirInclude = true |
| 172 | } |
| 173 | processDir(filepath.Join(dir, fi.Name()), dirInclude) |
| 174 | } else { |
| 175 | processFile(filepath.Join(dir, fi.Name()), include) |
| 176 | } |
| 177 | } |
| 178 | } |
| 179 | |
| 180 | // processFile process one file checking if it has the shaders extension, |
| 181 | // otherwise it is ignored. |
no test coverage detected