diff options
author | PikalaxALT <pikalaxalt@gmail.com> | 2021-11-11 15:53:24 -0500 |
---|---|---|
committer | PikalaxALT <pikalaxalt@gmail.com> | 2021-11-11 15:53:24 -0500 |
commit | 94e97e9e77ed2e54faf76716d76406b81d24c14e (patch) | |
tree | 2a3fa841127854221524fb719b227670fa8c6701 /.github/calcrom/Glob.cpp | |
parent | 7af4107235e6c178d5740782fe510d2df1c825b1 (diff) |
Sync calcrom from heartgold
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); +} |