MCPcopy Create free account
hub / github.com/apitrace/apitrace / findScript

Function findScript

cli/cli_resources.cpp:154–200  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

152}
153
154os::String
155findScript(const char *scriptFilename, bool verbose)
156{
157 os::String scriptPath;
158
159 os::String processDir = os::getProcessName();
160 processDir.trimFilename();
161
162 // Try relative build directory
163 // XXX: Just make build and install directory layout match
164#if defined(APITRACE_SOURCE_DIR)
165 scriptPath = APITRACE_SOURCE_DIR;
166 scriptPath.join("scripts");
167 scriptPath.join(scriptFilename);
168 if (tryPath(scriptPath, verbose)) {
169 return scriptPath;
170 }
171#endif
172
173 // Try relative install directory
174 scriptPath = processDir;
175#if defined(_WIN32)
176 scriptPath.join("..\\lib\\scripts");
177#elif defined(__APPLE__)
178 scriptPath.join("../lib/scripts");
179#else
180 scriptPath.join("../lib/apitrace/scripts");
181#endif
182 scriptPath.join(scriptFilename);
183 if (tryPath(scriptPath, verbose)) {
184 return scriptPath;
185 }
186
187#ifndef _WIN32
188 // Try absolute install directory
189 scriptPath = APITRACE_SCRIPTS_INSTALL_DIR;
190 scriptPath.join(scriptFilename);
191 if (tryPath(scriptPath, verbose)) {
192 return scriptPath;
193 }
194 std::cerr << "error: cannot find " << scriptPath << " script\n";
195#else
196 std::cerr << "error: cannot find " << scriptFilename << " script\n";
197#endif
198
199 exit(1);
200}

Callers 4

find_commandFunction · 0.85
find_commandFunction · 0.85
find_commandFunction · 0.85
find_commandFunction · 0.85

Calls 2

tryPathFunction · 0.85
getProcessNameFunction · 0.50

Tested by

no test coverage detected