Collect directory names under path/modules/ without loading anything
| 110 | |
| 111 | // Collect directory names under path/modules/ without loading anything |
| 112 | static 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 | |
| 148 | static bool init_modules_for_folder(FileAccessPtr fa, const das::string &path, das::TextWriter &tout, |
| 149 | const das_hash_set<das::string> *skip_set = nullptr) { |
no test coverage detected