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 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | tools/tests/skimage/output-actual/empty-dir/README » ('j') | tools/tests/skimage_self_test.py » ('J')
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 a6a2736e8d6852743f252c5332c52bb89ced8077..01dbc468f13699663b625fa75e79a1d7b05e0e6c 100644
--- a/tools/skimage_main.cpp
+++ b/tools/skimage_main.cpp
@@ -501,21 +501,20 @@ int tool_main(int argc, char** argv) {
}
for (int i = 0; i < FLAGS_readPath.count(); i++) {
- if (strlen(FLAGS_readPath[i]) < 1) {
+ const char* readPath = FLAGS_readPath[i];
+ if (strlen(readPath) < 1) {
break;
}
- SkOSFile::Iter iter(FLAGS_readPath[i]);
- SkString filename;
- if (iter.next(&filename)) {
- SkString directory(FLAGS_readPath[i]);
- append_path_separator_if_necessary(&directory);
- do {
- SkString fullname(directory);
- fullname.append(filename);
+ if (sk_isdir(readPath)) {
+ const char* dir = readPath;
+ SkOSFile::Iter iter(dir);
+ SkString filename;
+ while (iter.next(&filename)) {
+ SkString fullname = SkOSPath::SkPathJoin(dir, filename.c_str());
decodeFileAndWrite(fullname.c_str(), outDirPtr);
- } while (iter.next(&filename));
- } else {
- decodeFileAndWrite(FLAGS_readPath[i], outDirPtr);
+ }
+ } else if (sk_exists(readPath)) {
+ decodeFileAndWrite(readPath, outDirPtr);
}
}
« 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