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

Unified Diff: gm/gmmain.cpp

Issue 14855005: GM: fix --mismatchPath option (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: remove_temporary_selftest_changes Created 7 years, 8 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: gm/gmmain.cpp
===================================================================
--- gm/gmmain.cpp (revision 8959)
+++ gm/gmmain.cpp (working copy)
@@ -1640,6 +1640,26 @@
return total;
}
+bool prepare_subdirectories(const char *root, bool useFileHierarchy,
+ const SkTDArray<size_t> &configs);
+bool prepare_subdirectories(const char *root, bool useFileHierarchy,
+ const SkTDArray<size_t> &configs) {
+ if (!sk_mkdir(root)) {
+ return false;
+ }
+ if (useFileHierarchy) {
+ for (int i = 0; i < configs.count(); i++) {
+ ConfigData config = gRec[configs[i]];
+ SkString subdir;
+ subdir.appendf("%s%c%s", root, SkPATH_SEPARATOR, config.fName);
+ if (!sk_mkdir(subdir.c_str())) {
+ return false;
+ }
+ }
+ }
+ return true;
+}
+
int tool_main(int argc, char** argv);
int tool_main(int argc, char** argv) {
@@ -1851,6 +1871,9 @@
if (FLAGS_writePath.count() == 1) {
gm_fprintf(stdout, "writing to %s\n", FLAGS_writePath[0]);
}
+ if (NULL != gmmain.fMismatchPath) {
+ gm_fprintf(stdout, "writing mismatches to %s\n", gmmain.fMismatchPath);
+ }
if (FLAGS_writePicturePath.count() == 1) {
gm_fprintf(stdout, "writing pictures to %s\n", FLAGS_writePicturePath[0]);
}
@@ -1872,19 +1895,13 @@
// If we will be writing out files, prepare subdirectories.
if (FLAGS_writePath.count() == 1) {
- if (!sk_mkdir(FLAGS_writePath[0])) {
+ if (!prepare_subdirectories(FLAGS_writePath[0], gmmain.fUseFileHierarchy, configs)) {
return -1;
}
- if (gmmain.fUseFileHierarchy) {
- for (int i = 0; i < configs.count(); i++) {
- ConfigData config = gRec[configs[i]];
- SkString subdir;
- subdir.appendf("%s%c%s", FLAGS_writePath[0], SkPATH_SEPARATOR,
- config.fName);
- if (!sk_mkdir(subdir.c_str())) {
- return -1;
- }
- }
+ }
+ if (NULL != gmmain.fMismatchPath) {
+ if (!prepare_subdirectories(gmmain.fMismatchPath, gmmain.fUseFileHierarchy, configs)) {
+ return -1;
}
}
« 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