OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #include "gm_expectations.h" | 8 #include "gm_expectations.h" |
9 #include "SkBitmap.h" | 9 #include "SkBitmap.h" |
10 #include "SkColorPriv.h" | 10 #include "SkColorPriv.h" |
(...skipping 483 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
494 | 494 |
495 if (FLAGS_writePath.count() == 1) { | 495 if (FLAGS_writePath.count() == 1) { |
496 outDir.set(FLAGS_writePath[0]); | 496 outDir.set(FLAGS_writePath[0]); |
497 append_path_separator_if_necessary(&outDir); | 497 append_path_separator_if_necessary(&outDir); |
498 outDirPtr = &outDir; | 498 outDirPtr = &outDir; |
499 } else { | 499 } else { |
500 outDirPtr = NULL; | 500 outDirPtr = NULL; |
501 } | 501 } |
502 | 502 |
503 for (int i = 0; i < FLAGS_readPath.count(); i++) { | 503 for (int i = 0; i < FLAGS_readPath.count(); i++) { |
504 if (strlen(FLAGS_readPath[i]) < 1) { | 504 const char* readPath = FLAGS_readPath[i]; |
| 505 if (strlen(readPath) < 1) { |
505 break; | 506 break; |
506 } | 507 } |
507 SkOSFile::Iter iter(FLAGS_readPath[i]); | 508 if (sk_isdir(readPath)) { |
508 SkString filename; | 509 const char* dir = readPath; |
509 if (iter.next(&filename)) { | 510 SkOSFile::Iter iter(dir); |
510 SkString directory(FLAGS_readPath[i]); | 511 SkString filename; |
511 append_path_separator_if_necessary(&directory); | 512 while (iter.next(&filename)) { |
512 do { | 513 SkString fullname = SkOSPath::SkPathJoin(dir, filename.c_str()); |
513 SkString fullname(directory); | |
514 fullname.append(filename); | |
515 decodeFileAndWrite(fullname.c_str(), outDirPtr); | 514 decodeFileAndWrite(fullname.c_str(), outDirPtr); |
516 } while (iter.next(&filename)); | 515 } |
517 } else { | 516 } else if (sk_exists(readPath)) { |
518 decodeFileAndWrite(FLAGS_readPath[i], outDirPtr); | 517 decodeFileAndWrite(readPath, outDirPtr); |
519 } | 518 } |
520 } | 519 } |
521 | 520 |
522 if (!FLAGS_createExpectationsPath.isEmpty()) { | 521 if (!FLAGS_createExpectationsPath.isEmpty()) { |
523 // Use an empty value for everything besides expectations, since the rea
der only cares | 522 // Use an empty value for everything besides expectations, since the rea
der only cares |
524 // about the expectations. | 523 // about the expectations. |
525 Json::Value nullValue; | 524 Json::Value nullValue; |
526 Json::Value root = skiagm::CreateJsonTree(gExpectationsToWrite, nullValu
e, nullValue, | 525 Json::Value root = skiagm::CreateJsonTree(gExpectationsToWrite, nullValu
e, nullValue, |
527 nullValue, nullValue); | 526 nullValue, nullValue); |
528 std::string jsonStdString = root.toStyledString(); | 527 std::string jsonStdString = root.toStyledString(); |
(...skipping 15 matching lines...) Expand all Loading... |
544 } | 543 } |
545 | 544 |
546 return failed ? -1 : 0; | 545 return failed ? -1 : 0; |
547 } | 546 } |
548 | 547 |
549 #if !defined SK_BUILD_FOR_IOS | 548 #if !defined SK_BUILD_FOR_IOS |
550 int main(int argc, char * const argv[]) { | 549 int main(int argc, char * const argv[]) { |
551 return tool_main(argc, (char**) argv); | 550 return tool_main(argc, (char**) argv); |
552 } | 551 } |
553 #endif | 552 #endif |
OLD | NEW |