]> git.cworth.org Git - apitrace/commitdiff
Move trace::findWrapper to trace_resource.cpp
authorCarl Worth <cworth@cworth.org>
Sun, 12 Aug 2012 23:01:09 +0000 (16:01 -0700)
committerJosé Fonseca <jose.r.fonseca@gmail.com>
Sun, 18 Nov 2012 14:33:53 +0000 (14:33 +0000)
It's not actually used outside of trace_tools_trace.cpp, but it is so
similar to the existing trace::findScript in trace_resource.cpp that
there are benefits to having them defined in the same file.

common/trace_resource.cpp
common/trace_resource.hpp
common/trace_tools_trace.cpp

index 8a1f56cb1b9ca88c825579c98608a6ae5a2c2db1..51cd72df253774a301b5e41e95a4cca9d12f2a4f 100644 (file)
 
 namespace trace {
 
+os::String
+findWrapper(const char *wrapperFilename)
+{
+    os::String wrapperPath;
+
+    os::String processDir = os::getProcessName();
+    processDir.trimFilename();
+
+    // Try relative build directory
+    // XXX: Just make build and install directory layout match
+    wrapperPath = processDir;
+    wrapperPath.join("wrappers");
+    wrapperPath.join(wrapperFilename);
+    if (wrapperPath.exists()) {
+        return wrapperPath;
+    }
+
+    // Try relative install directory
+    wrapperPath = processDir;
+#if defined(_WIN32)
+    wrapperPath.join("..\\lib\\wrappers");
+#elif defined(__APPLE__)
+    wrapperPath.join("../lib/wrappers");
+#else
+    wrapperPath.join("../lib/apitrace/wrappers");
+#endif
+    wrapperPath.join(wrapperFilename);
+    if (wrapperPath.exists()) {
+        return wrapperPath;
+    }
+
+#ifndef _WIN32
+    // Try absolute install directory
+    wrapperPath = APITRACE_WRAPPERS_INSTALL_DIR;
+    wrapperPath.join(wrapperFilename);
+    if (wrapperPath.exists()) {
+        return wrapperPath;
+    }
+#endif
+
+    return "";
+}
 
 os::String
 findScript(const char *scriptFilename)
index 1d0a31b95a291435645921620164f5ee604faf06..35c8399eff5f9054b4ba4c0e6077d88b5f6b5e98 100644 (file)
@@ -39,6 +39,8 @@ namespace trace {
 os::String
 findScript(const char *name);
 
+os::String
+findWrapper(const char *wrapperFilename);
 
 } /* namespace trace */
 
index 5c88a25626c91ad77a9ba30ab5532c5dc0e80f65..387e2e25b97f562f7579b5eb3cd6b8e713a7499e 100644 (file)
@@ -33,6 +33,7 @@
 #include "os_string.hpp"
 #include "os_process.hpp"
 #include "trace_tools.hpp"
+#include "trace_resource.hpp"
 
 
 
@@ -51,50 +52,6 @@ namespace trace {
 #endif
 
 
-static os::String
-findWrapper(const char *wrapperFilename)
-{
-    os::String wrapperPath;
-
-    os::String processDir = os::getProcessName();
-    processDir.trimFilename();
-
-    // Try relative build directory
-    // XXX: Just make build and install directory layout match
-    wrapperPath = processDir;
-    wrapperPath.join("wrappers");
-    wrapperPath.join(wrapperFilename);
-    if (wrapperPath.exists()) {
-        return wrapperPath;
-    }
-
-    // Try relative install directory
-    wrapperPath = processDir;
-#if defined(_WIN32)
-    wrapperPath.join("..\\lib\\wrappers");
-#elif defined(__APPLE__)
-    wrapperPath.join("../lib/wrappers");
-#else
-    wrapperPath.join("../lib/apitrace/wrappers");
-#endif
-    wrapperPath.join(wrapperFilename);
-    if (wrapperPath.exists()) {
-        return wrapperPath;
-    }
-
-#ifndef _WIN32
-    // Try absolute install directory
-    wrapperPath = APITRACE_WRAPPERS_INSTALL_DIR;
-    wrapperPath.join(wrapperFilename);
-    if (wrapperPath.exists()) {
-        return wrapperPath;
-    }
-#endif
-
-    return "";
-}
-
-
 int
 traceProgram(API api,
              char * const *argv,