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

Side by Side 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: SkString mega efficiency patch Created 7 years, 4 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « tools/skpdiff/skpdiff_util.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2013 Google Inc. 2 * Copyright 2013 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #if SK_BUILD_FOR_MAC || SK_BUILD_FOR_UNIX || SK_BUILD_FOR_ANDROID 8 #if SK_BUILD_FOR_MAC || SK_BUILD_FOR_UNIX || SK_BUILD_FOR_ANDROID
9 # include <unistd.h> 9 # include <unistd.h>
10 # include <sys/time.h> 10 # include <sys/time.h>
11 # include <dirent.h> 11 # include <dirent.h>
12 #endif 12 #endif
13 13
14 #if SK_BUILD_FOR_MAC || SK_BUILD_FOR_UNIX 14 #if SK_BUILD_FOR_MAC || SK_BUILD_FOR_UNIX
15 # include <glob.h> 15 # include <glob.h>
16 #endif 16 #endif
17 17
18 #if SK_BUILD_FOR_MAC
19 # include <sys/syslimits.h> // PATH_MAX is here for Macs
20 #endif
21
18 #if SK_BUILD_FOR_WIN32 22 #if SK_BUILD_FOR_WIN32
19 # include <windows.h> 23 # include <windows.h>
20 #endif 24 #endif
21 25
26 #include <stdlib.h>
22 #include <time.h> 27 #include <time.h>
23 #include "SkOSFile.h" 28 #include "SkOSFile.h"
24 #include "skpdiff_util.h" 29 #include "skpdiff_util.h"
25 30
26 #if SK_SUPPORT_OPENCL 31 #if SK_SUPPORT_OPENCL
27 const char* cl_error_to_string(cl_int err) { 32 const char* cl_error_to_string(cl_int err) {
28 switch (err) { 33 switch (err) {
29 case CL_SUCCESS: return "CL_SUCCESS"; 34 case CL_SUCCESS: return "CL_SUCCESS";
30 case CL_DEVICE_NOT_FOUND: return "CL_DEVICE_NOT_FOUND"; 35 case CL_DEVICE_NOT_FOUND: return "CL_DEVICE_NOT_FOUND";
31 case CL_DEVICE_NOT_AVAILABLE: return "CL_DEVICE_NOT_AVAILABLE "; 36 case CL_DEVICE_NOT_AVAILABLE: return "CL_DEVICE_NOT_AVAILABLE ";
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 paths++; 179 paths++;
175 } 180 }
176 181
177 globfree(&globBuffer); 182 globfree(&globBuffer);
178 183
179 return true; 184 return true;
180 #else 185 #else
181 return false; 186 return false;
182 #endif 187 #endif
183 } 188 }
189
190 SkString get_absolute_path(const SkString& path) {
191 #if SK_BUILD_FOR_MAC || SK_BUILD_FOR_UNIX || SK_BUILD_FOR_ANDROID
192 SkString fullPath(PATH_MAX + 1);
193 if (realpath(path.c_str(), fullPath.writable_str()) == NULL) {
194 fullPath.reset();
195 }
196 return fullPath;
197 #elif SK_BUILD_FOR_WIN32
198 SkString fullPath(MAX_PATH);
199 if (_fullpath(fullPath.writable_str(), path.c_str(), MAX_PATH) == NULL) {
200 fullPath.reset();
201 }
202 return fullPath;
203 #else
204 return SkString();
205 #endif
206 }
OLDNEW
« no previous file with comments | « tools/skpdiff/skpdiff_util.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698