mirror of
https://github.com/pret/pmd-sky.git
synced 2026-03-21 17:25:15 -05:00
17 lines
529 B
C++
17 lines
529 B
C++
#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);
|
|
}
|