MCPcopy
hub / github.com/g3n/engine / processDir

Function processDir

tools/g3nshaders/main.go:151–178  ·  view source on GitHub ↗

processDir processes recursively all shaders files in the specified directory

(dir string, include bool)

Source from the content-addressed store, hash-verified

149
150// processDir processes recursively all shaders files in the specified directory
151func 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.

Callers 1

mainFunction · 0.85

Calls 4

processFileFunction · 0.85
IsDirMethod · 0.80
CloseMethod · 0.65
NameMethod · 0.65

Tested by

no test coverage detected