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

Unified Diff: src/utils/SkOSPathUtils.cpp

Issue 15747004: Add path utils, plus a test for it. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Respond to comments. 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
Index: src/utils/SkOSPathUtils.cpp
diff --git a/src/utils/SkOSPathUtils.cpp b/src/utils/SkOSPathUtils.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..fddfed485945aabfa59f759e5828f8ca5b8650c3
--- /dev/null
+++ b/src/utils/SkOSPathUtils.cpp
@@ -0,0 +1,32 @@
+/*
+ * 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;
+}
+
+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);
+}
« no previous file with comments | « include/utils/SkOSPathUtils.h ('k') | tests/OSPathUtilsTest.cpp » ('j') | tools/skimage_main.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698