| 152 | } |
| 153 | |
| 154 | os::String |
| 155 | findScript(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 | } |
no test coverage detected