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

Unified 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 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 478a0cc44868e4376e5839a052a151729e0d7ff6..73cc147a24c81a5f13b5b2da41c39f74d83678bd 100644
--- a/src/utils/SkOSFile.cpp
+++ b/src/utils/SkOSFile.cpp
@@ -226,4 +226,25 @@ bool SkOSFile::Iter::next(SkString* name, bool getDir)
return false;
}
+SkString SkOSPath::SkPathJoin(const char *rootPath, const char *relativePath) {
+ SkString result(rootPath);
+ if (!result.endsWith(SkPATH_SEPARATOR)) {
+ result.appendUnichar(SkPATH_SEPARATOR);
+ }
+ result.append(relativePath);
+ return result;
+}
+
+SkString SkOSPath::SkBasename(const char* fullPath) {
+ if (!fullPath) {
+ return SkString();
+ }
+ const char* filename = strrchr(fullPath, SkPATH_SEPARATOR);
+ if (NULL == filename) {
+ filename = fullPath;
+ } else {
+ ++filename;
+ }
+ return SkString(filename);
+}
#endif
« 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