diff options
Diffstat (limited to '.github/calcrom/Glob.cpp')
-rw-r--r-- | .github/calcrom/Glob.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/.github/calcrom/Glob.cpp b/.github/calcrom/Glob.cpp new file mode 100644 index 00000000..cb519233 --- /dev/null +++ b/.github/calcrom/Glob.cpp @@ -0,0 +1,16 @@ +#include <stdexcept> +#include "Glob.h" + +Glob::Glob(const char *pattern, int _glob_flags) : glob_flags(_glob_flags) { + int result = glob(pattern, glob_flags, nullptr, &glob_result); + if (result) { + throw runtime_error(string("Glob(") + pattern + ") failed with error " + to_string(result)); + } + assign(glob_result.gl_pathv, glob_result.gl_pathv + glob_result.gl_pathc); +} + +Glob::Glob(const string& pattern, int _glob_flags) : Glob(pattern.c_str(), _glob_flags) {} + +Glob::~Glob() { + globfree(&glob_result); +} |