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

Unified Diff: experimental/skpdiff/skpdiff_util.cpp

Issue 17881002: add globbing util function (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: add TODO 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 | « experimental/skpdiff/skpdiff_util.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: experimental/skpdiff/skpdiff_util.cpp
diff --git a/experimental/skpdiff/skpdiff_util.cpp b/experimental/skpdiff/skpdiff_util.cpp
index 285e04c063c24783763e5e6585bd799fbc7af08f..3a36a12dbf510bb12238dc11af0bad2f401c9234 100644
--- a/experimental/skpdiff/skpdiff_util.cpp
+++ b/experimental/skpdiff/skpdiff_util.cpp
@@ -7,6 +7,7 @@
#include <time.h>
#include <dirent.h>
+#include <glob.h>
#include "SkOSFile.h"
#include "skpdiff_util.h"
@@ -90,5 +91,27 @@ bool get_directory(const char path[], SkTArray<SkString>* entries) {
}
}
+ closedir(dir);
+
+ return true;
+}
+
+bool glob_files(const char globPattern[], SkTArray<SkString>* entries) {
+ // TODO Make sure this works on windows. This may require use of FindNextFile windows function.
+ glob_t globBuffer;
+ if (glob(globPattern, 0, NULL, &globBuffer) != 0) {
+ return false;
+ }
+
+ // Note these paths are in sorted order by default according to http://linux.die.net/man/3/glob
+ // Check under the flag GLOB_NOSORT
+ char** paths = globBuffer.gl_pathv;
+ while(NULL != *paths) {
+ entries->push_back(SkString(*paths));
+ paths++;
+ }
+
+ globfree(&globBuffer);
+
return true;
}
« no previous file with comments | « experimental/skpdiff/skpdiff_util.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698