Normalize a module-folder basename for case-insensitive shadow comparisons on filesystems that are case-insensitive at the OS layer (Windows, default macOS HFS+/APFS). Without this, a user-supplied -load_module D:/mods/dasimgui (lowercase) would NOT shadow modules/dasImgui because the on-disk basenames are byte-compared. Linux ext4 is case-sensitive, so leave names untouched.
| 97 | // (lowercase) would NOT shadow modules/dasImgui because the on-disk basenames |
| 98 | // are byte-compared. Linux ext4 is case-sensitive, so leave names untouched. |
| 99 | static das::string normalize_module_name(const das::string &name) { |
| 100 | #if defined(_WIN32) || defined(__APPLE__) |
| 101 | das::string out = name; |
| 102 | for (auto &c : out) { |
| 103 | c = (char)tolower((unsigned char)c); |
| 104 | } |
| 105 | return out; |
| 106 | #else |
| 107 | return name; |
| 108 | #endif |
| 109 | } |
| 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) { |
no outgoing calls
no test coverage detected