Index: tools/skpdiff/skpdiff_util.cpp |
diff --git a/tools/skpdiff/skpdiff_util.cpp b/tools/skpdiff/skpdiff_util.cpp |
index 0047959b60fbda4496c868c613240839d0f9b6b8..80574e48abece2a55ba4ed93bb161782fc01d739 100644 |
--- a/tools/skpdiff/skpdiff_util.cpp |
+++ b/tools/skpdiff/skpdiff_util.cpp |
@@ -15,10 +15,15 @@ |
# include <glob.h> |
#endif |
+#if SK_BUILD_FOR_MAC |
+# include <sys/syslimits.h> // PATH_MAX is here for Macs |
+#endif |
+ |
#if SK_BUILD_FOR_WIN32 |
# include <windows.h> |
#endif |
+#include <stdlib.h> |
#include <time.h> |
#include "SkOSFile.h" |
#include "skpdiff_util.h" |
@@ -181,3 +186,21 @@ bool glob_files(const char globPattern[], SkTArray<SkString>* entries) { |
return false; |
#endif |
} |
+ |
+SkString get_absolute_path(const SkString& path) { |
+#if SK_BUILD_FOR_MAC || SK_BUILD_FOR_UNIX || SK_BUILD_FOR_ANDROID |
+ char fullPath[PATH_MAX + 1]; |
djsollen
2013/08/01 20:03:32
SkString fullPath(PATH_MAX + 1);
if (realpath(path
|
+ if (realpath(path.c_str(), fullPath) == NULL) { |
+ return SkString(); |
+ } |
+ return SkString(fullPath); |
+#elif SK_BUILD_FOR_WIN32 |
+ char fullPath[MAX_PATH]; |
+ if (_fullpath(fullPath, path.c_str(), MAX_PATH) == NULL) { |
+ return SkString(); |
+ } |
+ return SkString(fullPath); |
+#else |
+ return SkString(); |
+#endif |
+} |