Chromium Code Reviews| Index: experimental/skpdiff/skpdiff_util.cpp |
| diff --git a/experimental/skpdiff/skpdiff_util.cpp b/experimental/skpdiff/skpdiff_util.cpp |
| index 285e04c063c24783763e5e6585bd799fbc7af08f..8a8df3ea47a757e9616007e48c9316d288e065f4 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) { |
| + // Heres how to do it in windows: http://msdn.microsoft.com/en-us/library/windows/desktop/aa364428(v=vs.85).aspx |
|
djsollen
2013/06/26 13:41:18
exceeds 100 char limit.
document with a TODO that
|
| + 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; |
| } |