Index: src/utils/SkOSPathUtils.cpp |
diff --git a/src/utils/SkOSPathUtils.cpp b/src/utils/SkOSPathUtils.cpp |
new file mode 100644 |
index 0000000000000000000000000000000000000000..e892c1df327fd71df481c54270042fee0cf90d96 |
--- /dev/null |
+++ b/src/utils/SkOSPathUtils.cpp |
@@ -0,0 +1,27 @@ |
+/* |
+ * Copyright 2013 Google Inc. |
+ * |
+ * Use of this source code is governed by a BSD-style license that can be |
+ * found in the LICENSE file. |
+ */ |
+ |
+#include "SkOSFile.h" |
+#include "SkOSPathUtils.h" |
+#include "SkString.h" |
+ |
+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; |
+} |
+ |
+const char* SkBasename(const char* fullPath) { |
+ const char* filename = strrchr(fullPath, SkPATH_SEPARATOR); |
+ if (NULL == filename || *++filename == '\0') { |
+ filename = fullPath; |
+ } |
+ return filename; |
+} |