]> git.cworth.org Git - apitrace/blobdiff - common/trace_resource.cpp
dump-images: Execute glretrace from source dir when running uninstalled
[apitrace] / common / trace_resource.cpp
index 51cd72df253774a301b5e41e95a4cca9d12f2a4f..04ac32709dfa09eea11d1d1951dee9948282cf26 100644 (file)
 
 namespace trace {
 
+os::String
+findProgram(const char*programFilename)
+{
+    os::String programPath;
+
+    os::String processDir = os::getProcessName();
+    processDir.trimFilename();
+
+    programPath = processDir;
+    programPath.join(programFilename);
+    if (programPath.exists()) {
+        return programPath;
+    }
+
+#ifndef _WIN32
+    // Try absolute install directory
+    programPath = APITRACE_PROGRAMS_INSTALL_DIR;
+    programPath.join(programFilename);
+    if (programPath.exists()) {
+        return programPath;
+    }
+#endif
+
+    return "";
+}
+
 os::String
 findWrapper(const char *wrapperFilename)
 {