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

Unified Diff: src/utils/SkOSFile.cpp

Issue 450743002: Add option to dump images from nanobench. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: move the clear Created 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « include/core/SkOSFile.h ('k') | tests/OSPathTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/utils/SkOSFile.cpp
diff --git a/src/utils/SkOSFile.cpp b/src/utils/SkOSFile.cpp
index 8baf08ffdd394068e0dcc065964dcf54b45ff62a..04a4fe910e9ae2da0f9ed1fd604a8cb638891ed7 100644
--- a/src/utils/SkOSFile.cpp
+++ b/src/utils/SkOSFile.cpp
@@ -8,7 +8,7 @@
SkString SkOSPath::Join(const char *rootPath, const char *relativePath) {
SkString result(rootPath);
- if (!result.endsWith(SkPATH_SEPARATOR)) {
+ if (!result.endsWith(SkPATH_SEPARATOR) && !result.isEmpty()) {
result.appendUnichar(SkPATH_SEPARATOR);
}
result.append(relativePath);
@@ -28,6 +28,21 @@ SkString SkOSPath::Basename(const char* fullPath) {
return SkString(filename);
}
+SkString SkOSPath::Dirname(const char* fullPath) {
+ if (!fullPath) {
+ return SkString();
+ }
+ const char* end = strrchr(fullPath, SkPATH_SEPARATOR);
+ if (NULL == end) {
+ return SkString();
+ }
+ if (end == fullPath) {
+ SkASSERT(fullPath[0] == SkPATH_SEPARATOR);
+ ++end;
+ }
+ return SkString(fullPath, end - fullPath);
+}
+
#ifdef SK_BUILD_FOR_WIN
static uint16_t* concat_to_16(const char src[], const char suffix[])
« 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