Chromium Code Reviews| Index: src/utils/SkOSFile.cpp |
| diff --git a/src/utils/SkOSFile.cpp b/src/utils/SkOSFile.cpp |
| index 478a0cc44868e4376e5839a052a151729e0d7ff6..016e708ce64b2c0e7d146b7a6050ba132acb412e 100644 |
| --- a/src/utils/SkOSFile.cpp |
| +++ b/src/utils/SkOSFile.cpp |
| @@ -226,4 +226,27 @@ bool SkOSFile::Iter::next(SkString* name, bool getDir) |
| return false; |
| } |
| +namespace SkOSPathUtils { |
|
epoger
2013/05/24 16:42:55
I agree that SkOSFile is declared/defined in a str
|
| + SkString 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 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 |