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

Side by Side Diff: src/utils/SkOSFile.cpp

Issue 15747004: Add path utils, plus a test for it. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: rebase Created 7 years, 7 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 | « include/core/SkOSFile.h ('k') | tests/OSPathTest.cpp » ('j') | 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 /* 2 /*
3 * Copyright 2011 Google Inc. 3 * Copyright 2011 Google Inc.
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 #include "SkOSFile.h" 8 #include "SkOSFile.h"
9 9
10 #ifdef SK_BUILD_FOR_WIN 10 #ifdef SK_BUILD_FOR_WIN
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
219 if (entry) // we broke out with a file 219 if (entry) // we broke out with a file
220 { 220 {
221 if (name) 221 if (name)
222 name->set(entry->d_name); 222 name->set(entry->d_name);
223 return true; 223 return true;
224 } 224 }
225 } 225 }
226 return false; 226 return false;
227 } 227 }
228 228
229 SkString SkOSPath::SkPathJoin(const char *rootPath, const char *relativePath) {
230 SkString result(rootPath);
231 if (!result.endsWith(SkPATH_SEPARATOR)) {
232 result.appendUnichar(SkPATH_SEPARATOR);
233 }
234 result.append(relativePath);
235 return result;
236 }
237
238 SkString SkOSPath::SkBasename(const char* fullPath) {
239 if (!fullPath) {
240 return SkString();
241 }
242 const char* filename = strrchr(fullPath, SkPATH_SEPARATOR);
243 if (NULL == filename) {
244 filename = fullPath;
245 } else {
246 ++filename;
247 }
248 return SkString(filename);
249 }
229 #endif 250 #endif
OLDNEW
« no previous file with comments | « include/core/SkOSFile.h ('k') | tests/OSPathTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698