MCPcopy Create free account
hub / github.com/IppClub/Dora-SSR / cliFindScript

Function cliFindScript

Source/Basic/Application.cpp:487–511  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

485}
486
487std::optional<fs::path> cliFindScript(int argc, char* argv[], const std::optional<fs::path>& assetPath) {
488 if (auto script = std::getenv("DORA_CLI_SCRIPT")) {
489 if (*script) return cliAbsolutePath(script);
490 }
491 std::vector<fs::path> candidates;
492 if (assetPath) {
493 candidates.push_back(*assetPath);
494 }
495 candidates.insert(candidates.end(), {
496 fs::current_path() / "Assets",
497 fs::current_path(),
498 });
499 if (argc > 0 && argv[0] && *argv[0]) {
500 auto exe = cliAbsolutePath(argv[0]);
501 auto exeDir = exe.parent_path();
502 candidates.push_back(exeDir / "../Resources");
503 candidates.push_back(exeDir / "..");
504 }
505 for (const auto& candidate : candidates) {
506 if (auto script = cliFindScriptInRoot(candidate)) {
507 return script;
508 }
509 }
510 return std::nullopt;
511}
512
513int runCliApplication(int argc, char* argv[]) {
514 auto cliIndex = cliCommandIndex(argc, argv);

Callers 1

runCliApplicationFunction · 0.85

Calls 8

getenvFunction · 0.85
cliAbsolutePathFunction · 0.85
current_pathFunction · 0.85
cliFindScriptInRootFunction · 0.85
parent_pathMethod · 0.80
insertMethod · 0.65
push_backMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected