Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(421)

Unified Diff: tools/skpdiff/skpdiff_util.cpp

Issue 21601002: fix skpdiff viewer bug when using relative paths (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: mac PATH_MAX Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« tools/skpdiff/skpdiff_util.h ('K') | « tools/skpdiff/skpdiff_util.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/skpdiff/skpdiff_util.cpp
diff --git a/tools/skpdiff/skpdiff_util.cpp b/tools/skpdiff/skpdiff_util.cpp
index 0047959b60fbda4496c868c613240839d0f9b6b8..e06a314d5c6d56de62588f6506443dcc22736022 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,15 @@ bool glob_files(const char globPattern[], SkTArray<SkString>* entries) {
return false;
#endif
}
+
+char* get_absolute_path(const char path[]) {
+#if SK_BUILD_FOR_MAC || SK_BUILD_FOR_UNIX || SK_BUILD_FOR_ANDROID
+ char* fullPath = (char*)malloc(PATH_MAX+1);
+ return realpath(path, fullPath); // On failure this returns NULL, and fullPath on success.
+#elif SK_BUILD_FOR_WIN32
+ // By passing in NULL, we are asking windows to malloc the memory for us. The 0 is ignored.
+ return _fullpath(NULL, path, 0);
+#else
+ return NULL
+#endif
+}
« tools/skpdiff/skpdiff_util.h ('K') | « tools/skpdiff/skpdiff_util.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698