| 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[])
|
|
|