MCPcopy Create free account
hub / github.com/GaijinEntertainment/daScript / collect_module_names

Function collect_module_names

src/ast/dyn_modules.cpp:112–146  ·  view source on GitHub ↗

Collect directory names under path/modules/ without loading anything

Source from the content-addressed store, hash-verified

110
111// Collect directory names under path/modules/ without loading anything
112static das_hash_set<das::string> collect_module_names(const das::string &path) {
113 das_hash_set<das::string> result;
114#if DAS_NO_FILEIO
115 return result;
116#else
117 das::string modules_path = path + "/modules/";
118#if defined(_MSC_VER)
119 _finddata_t c_file;
120 intptr_t hFile;
121 das::string findPath = modules_path + "/*";
122 if ((hFile = _findfirst(findPath.c_str(), &c_file)) != -1L) {
123 do {
124 if (c_file.name[0] == '.') {
125 continue;
126 }
127 result.insert(normalize_module_name(das::string(c_file.name)));
128 } while (_findnext(hFile, &c_file) == 0);
129 _findclose(hFile);
130 }
131#else
132 DIR *dir;
133 struct dirent *ent;
134 if ((dir = opendir(modules_path.c_str())) != NULL) {
135 while ((ent = readdir(dir)) != NULL) {
136 if (ent->d_name[0] == '.') {
137 continue;
138 }
139 result.insert(normalize_module_name(das::string(ent->d_name)));
140 }
141 closedir(dir);
142 }
143#endif
144 return result;
145#endif // DAS_NO_FILEIO
146}
147
148static bool init_modules_for_folder(FileAccessPtr fa, const das::string &path, das::TextWriter &tout,
149 const das_hash_set<das::string> *skip_set = nullptr) {

Callers 1

require_dynamic_modulesFunction · 0.85

Calls 7

normalize_module_nameFunction · 0.85
stringClass · 0.85
opendirFunction · 0.85
readdirFunction · 0.85
closedirFunction · 0.85
c_strMethod · 0.45
insertMethod · 0.45

Tested by

no test coverage detected