Try a candidate dir / rel_path; if it (or its _debug variant in debug builds, gated on DAS_NO_ASSERTIONS to match register_dynamic_module's rewrite at module_builtin_fio.cpp:1099) exists, return the path to load. Empty string = miss. Returns the non-_debug name even when the _debug variant is what exists — register_dynamic_module applies the _debug rewrite itself in debug builds, so we mustn't do
| 1308 | // trailing-separator and root cases correctly (POSIX `/` + `modules/X` → |
| 1309 | // `/modules/X`, not `//modules/X`). |
| 1310 | static das::string pick_at_dir ( const std::filesystem::path & dir, const char * rel_path ) { |
| 1311 | namespace fs = std::filesystem; |
| 1312 | if ( dir.empty() || !rel_path || !*rel_path ) return ""; |
| 1313 | fs::path candidate = dir / rel_path; |
| 1314 | das::string candidate_str = candidate.string().c_str(); |
| 1315 | if ( jit_path_exists(candidate_str.c_str()) ) return candidate_str; |
| 1316 | #ifndef DAS_NO_ASSERTIONS |
| 1317 | if ( candidate.extension() == ".shared_module" ) { |
| 1318 | fs::path dbg = candidate.parent_path() / (candidate.stem().string() + "_debug" + candidate.extension().string()); |
| 1319 | if ( jit_path_exists(dbg.string().c_str()) ) return candidate_str; |
| 1320 | } |
| 1321 | #endif |
| 1322 | return ""; |
| 1323 | } |
| 1324 | |
| 1325 | // Pure resolution: pick the path to load, in priority order: |
| 1326 | // 1. <exe_dir>/<rel_path> — daspkg release bundle layout (modules sit next to the exe) |
no test coverage detected