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

Function normalize_module_name

src/ast/dyn_modules.cpp:99–109  ·  view source on GitHub ↗

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.

Source from the content-addressed store, hash-verified

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.
99static 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
112static das_hash_set<das::string> collect_module_names(const das::string &path) {

Callers 3

collect_module_namesFunction · 0.85
init_modules_for_folderFunction · 0.85
require_dynamic_modulesFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected