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

Unified Diff: tools/skimage_main.cpp

Issue 18175008: Skip the TIMESTAMP file. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Respond to comment Created 7 years, 6 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
« no previous file with comments | « no previous file | 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 572f9f54f6a8040eb0280db1742c206b98a9083c..6cfc36c7372820760d5986e5e03e434cba3b3de6 100644
--- a/tools/skimage_main.cpp
+++ b/tools/skimage_main.cpp
@@ -489,6 +489,22 @@ static void append_path_separator_if_necessary(SkString* directory) {
}
}
+/**
+ * Return true if the filename represents an image.
+ */
+static bool is_image_file(const char* filename) {
+ const char* gImageExtensions[] = {
+ ".png", ".PNG", ".jpg", ".JPG", ".jpeg", ".JPEG", ".bmp", ".BMP",
+ ".webp", ".WEBP", ".ico", ".ICO", ".wbmp", ".WBMP", ".gif", ".GIF"
+ };
borenet 2013/06/28 20:02:02 I agree that this is cumbersome, but I think it's
+ for (size_t i = 0; i < SK_ARRAY_COUNT(gImageExtensions); ++i) {
+ if (SkStrEndsWith(filename, gImageExtensions[i])) {
+ return true;
+ }
+ }
+ return false;
+}
+
int tool_main(int argc, char** argv);
int tool_main(int argc, char** argv) {
SkCommandLineFlags::SetUsage("Decode files, and optionally write the results to files.");
@@ -528,10 +544,13 @@ int tool_main(int argc, char** argv) {
SkOSFile::Iter iter(dir);
SkString filename;
while (iter.next(&filename)) {
+ if (!is_image_file(filename.c_str())) {
+ continue;
+ }
SkString fullname = SkOSPath::SkPathJoin(dir, filename.c_str());
decodeFileAndWrite(fullname.c_str(), outDirPtr);
}
- } else if (sk_exists(readPath)) {
+ } else if (sk_exists(readPath) && is_image_file(readPath)) {
decodeFileAndWrite(readPath, outDirPtr);
}
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698