]> git.cworth.org Git - apitrace/blobdiff - cli/cli_trace.cpp
Make file_exists as os::Path method.
[apitrace] / cli / cli_trace.cpp
index 19739fd7440f8f3325b4d572e344bf757f01d9ee..df78d55fc575c1919746af24d4e6bb5ccd07d9c6 100644 (file)
@@ -51,7 +51,6 @@ usage(void)
 /* We only support "apitrace trace" on POSIX-like systems (not WIN32) */
 #ifndef _WIN32
 
-#include <sys/stat.h>
 
 #ifdef __APPLE__
 #define CLI_TRACE_VARIABLE "DYLD_LIBRARY_PATH"
@@ -61,22 +60,6 @@ usage(void)
 #define CLI_TRACE_WRAPPER  "glxtrace.so"
 #endif
 
-static int
-file_exists(const char *path)
-{
-    struct stat st;
-    int err;
-
-    err = stat(path, &st);
-    if (err)
-        return 0;
-
-    if (! S_ISREG(st.st_mode))
-        return 0;
-
-    return 1;
-}
-
 static os::Path
 find_wrapper(const char *filename)
 {
@@ -98,14 +81,14 @@ find_wrapper(const char *filename)
     complete.join(filename);
 #endif
 
-    if (file_exists(complete))
+    if (complete.exists())
         return complete;
 
     /* Second, look in the directory for installed wrappers. */
     complete = APITRACE_WRAPPER_INSTALL_DIR;
     complete.join(filename);
 
-    if (file_exists(complete))
+    if (complete.exists())
         return complete;
 
     std::cerr << "error: cannot find " << filename << " (looked in " <<