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

Function path_basename

src/ast/dyn_modules.cpp:199–214  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

197}
198
199static das::string path_basename(const das::string &path) {
200 // Trim trailing separators so "/mods/foo/" yields "foo" (otherwise
201 // `substr(slash+1)` would be empty and shadow-skip would key on "").
202 size_t end = path.size();
203 while (end > 0 && (path[end - 1] == '/' || path[end - 1] == '\\')) {
204 --end;
205 }
206 if (end == 0) {
207 return das::string();
208 }
209 auto slash = path.find_last_of("\\/", end - 1);
210 if (slash == das::string::npos) {
211 return path.substr(0, end);
212 }
213 return path.substr(slash + 1, end - slash - 1);
214}
215
216bool require_dynamic_modules(FileAccessPtr file_access,
217 const das::string &das_root,

Callers 1

require_dynamic_modulesFunction · 0.85

Calls 2

stringClass · 0.85
sizeMethod · 0.45

Tested by

no test coverage detected