| * Copyright 2011 Google Inc. |
| * Use of this source code is governed by a BSD-style license that can be |
| * found in the LICENSE file. |
| #include "src/utils/SkOSPath.h" |
| SkString SkOSPath::Join(const char *rootPath, const char *relativePath) { |
| SkString result(rootPath); |
| if (!result.endsWith(SEPARATOR) && !result.isEmpty()) { |
| result.appendUnichar(SEPARATOR); |
| result.append(relativePath); |
| SkString SkOSPath::Basename(const char* fullPath) { |
| const char* filename = strrchr(fullPath, SEPARATOR); |
| if (nullptr == filename) { |
| return SkString(filename); |
| SkString SkOSPath::Dirname(const char* fullPath) { |
| const char* end = strrchr(fullPath, SEPARATOR); |
| SkASSERT(fullPath[0] == SEPARATOR); |
| return SkString(fullPath, end - fullPath); |