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

Side by Side Diff: tools/skimage_main.cpp

Issue 17101029: Treat empty directory properly in skimage. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Use README files to force directories to exist. 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « no previous file | tools/tests/skimage/output-actual/empty-dir/README » ('j') | tools/tests/skimage_self_test.py » ('J')

Powered by Google App Engine
This is Rietveld 408576698