MCPcopy Create free account
hub / github.com/Redot-Engine/redot-engine / find_executable

Function find_executable

modules/mono/utils/path_utils.cpp:62–91  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

60namespace Path {
61
62String find_executable(const String &p_name) {
63#ifdef WINDOWS_ENABLED
64 Vector<String> exts = OS::get_singleton()->get_environment("PATHEXT").split(ENV_PATH_SEP, false);
65#endif
66 Vector<String> env_path = OS::get_singleton()->get_environment("PATH").split(ENV_PATH_SEP, false);
67
68 if (env_path.is_empty()) {
69 return String();
70 }
71
72 for (int i = 0; i < env_path.size(); i++) {
73 String p = Path::join(env_path[i], p_name);
74
75#ifdef WINDOWS_ENABLED
76 for (int j = 0; j < exts.size(); j++) {
77 String p2 = p + exts[j].to_lower(); // lowercase to reduce risk of case mismatch warning
78
79 if (FileAccess::exists(p2)) {
80 return p2;
81 }
82 }
83#else
84 if (FileAccess::exists(p)) {
85 return p;
86 }
87#endif
88 }
89
90 return String();
91}
92
93String cwd() {
94#ifdef WINDOWS_ENABLED

Callers

nothing calls this directly

Calls 7

joinFunction · 0.85
splitMethod · 0.80
to_lowerMethod · 0.80
sizeMethod · 0.65
StringClass · 0.50
get_environmentMethod · 0.45
is_emptyMethod · 0.45

Tested by

no test coverage detected