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

Unified Diff: tools/skimage_main.cpp

Issue 15747004: Add path utils, plus a test for it. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Remove extra SkPathJoin implementation. 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
« tests/OSPathUtilsTest.cpp ('K') | « tests/OSPathUtilsTest.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/skimage_main.cpp
diff --git a/tools/skimage_main.cpp b/tools/skimage_main.cpp
index 9739ced49d13df296d94f3ff19fb6dc0c0b5e5f1..ab681eda07bae043f757f1c16256ff088629346a 100644
--- a/tools/skimage_main.cpp
+++ b/tools/skimage_main.cpp
@@ -15,6 +15,7 @@
#include "SkImageDecoder.h"
#include "SkImageEncoder.h"
#include "SkOSFile.h"
+#include "SkOSPathUtils.h"
#include "SkRandom.h"
#include "SkStream.h"
#include "SkTArray.h"
@@ -70,27 +71,10 @@ static SkImageDecoder::Format guess_format_from_suffix(const char suffix[]) {
return SkImageDecoder::kUnknown_Format;
}
-/**
- * Return the name of the file, ignoring the directory structure.
- * Does not create a new string.
- * @param fullPath Full path to the file.
- * @return string The basename of the file - anything beyond the final slash, or the full name
- * if there is no slash.
- * TODO: Might this be useful as a utility function in SkOSFile? Would it be more appropriate to
- * create a new string?
- */
-static const char* SkBasename(const char* fullPath) {
- const char* filename = strrchr(fullPath, SkPATH_SEPARATOR);
- if (NULL == filename || *++filename == '\0') {
- filename = fullPath;
- }
- return filename;
-}
-
static void make_outname(SkString* dst, const char outDir[], const char src[],
const char suffix[]) {
const char* basename = SkBasename(src);
- dst->set(skiagm::SkPathJoin(outDir, basename));
+ dst->set(SkPathJoin(outDir, basename));
if (!dst->endsWith(suffix)) {
const char* cstyleDst = dst->c_str();
const char* dot = strrchr(cstyleDst, '.');
@@ -273,8 +257,7 @@ static bool write_subset(const char* writePath, const char* filename, const char
SkASSERT(bitmapFromDecodeSubset != NULL);
// Create a subdirectory to hold the results of decodeSubset.
- // TODO: Move SkPathJoin into SkOSFile.h
- SkString dir = skiagm::SkPathJoin(writePath, "subsets");
+ SkString dir = SkPathJoin(writePath, "subsets");
if (!sk_mkdir(dir.c_str())) {
gFailedSubsetDecodes.push_back().printf("Successfully decoded %s from %s, but failed to "
"create a directory to write to.", subsetDim,
@@ -299,7 +282,7 @@ static bool write_subset(const char* writePath, const char* filename, const char
return false;
}
- SkString dirExtracted = skiagm::SkPathJoin(writePath, "extracted");
+ SkString dirExtracted = SkPathJoin(writePath, "extracted");
if (!sk_mkdir(dirExtracted.c_str())) {
gFailedSubsetDecodes.push_back().printf("Successfully decoded %s from %s, but failed to "
"create a directory for extractSubset comparison.",
« tests/OSPathUtilsTest.cpp ('K') | « tests/OSPathUtilsTest.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698