MCPcopy Create free account
hub / github.com/GDRETools/gdsdecomp / iter_directory

Function iter_directory

utility/glob.cpp:312–330  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

310}
311
312Vector<String> iter_directory(const String &dir, bool dironly, bool include_hidden) {
313 Error err;
314 String real_dir = get_real_dir(dir);
315 Ref<DirAccess> da = DirAccess::open(real_dir, &err);
316 if (da.is_null()) {
317 return Vector<String>(); // fail silently
318 }
319 da->set_include_hidden(include_hidden);
320 Vector<String> ret = da->get_directories();
321 if (!dironly) {
322 ret.append_array(da->get_files());
323 }
324 if (dir.is_absolute_path()) {
325 for (int i = 0; i < ret.size(); i++) {
326 ret.ptrw()[i] = dir.path_join(ret[i]);
327 }
328 }
329 return ret;
330}
331
332// Recursively yields relative pathnames inside a literal directory.
333Vector<String> rlistdir(const String &dirname, bool dironly, bool include_hidden) {

Callers 2

rlistdirFunction · 0.85
glob1Function · 0.85

Calls 2

get_real_dirFunction · 0.85
sizeMethod · 0.45

Tested by

no test coverage detected