| 619 | } |
| 620 | |
| 621 | std::vector<std::string> globVector(const std::string& pattern) |
| 622 | { |
| 623 | std::vector<std::string> files; |
| 624 | #if defined(WIN32) || defined(_WIN32) || defined(__WIN32) && !defined(__CYGWIN__) |
| 625 | WIN32_FIND_DATAA find_result; |
| 626 | HANDLE find_handle = FindFirstFileA(pattern.c_str(), &find_result); |
| 627 | if (find_handle != INVALID_HANDLE_VALUE) { |
| 628 | do { |
| 629 | files.push_back(pattern.substr(0, pattern.find_last_of("/\\") + 1) + find_result.cFileName); |
| 630 | } while (FindNextFileA(find_handle, &find_result)); |
| 631 | FindClose(find_handle); |
| 632 | } |
| 633 | #else |
| 634 | #if defined(GLOB_SUPPORT) |
| 635 | glob_t glob_result; |
| 636 | if (!glob(pattern.c_str(), GLOB_TILDE, nullptr, &glob_result)) |
| 637 | { |
| 638 | for (unsigned int i=0; i<glob_result.gl_pathc; i++) |
| 639 | { |
| 640 | files.emplace_back(glob_result.gl_pathv[i]); |
| 641 | } |
| 642 | globfree(&glob_result); |
| 643 | } |
| 644 | #else |
| 645 | #warning GLOB_SUPPORT is not defined, the vector returned by this function will be empty! |
| 646 | static_cast<void>(pattern); |
| 647 | #endif |
| 648 | #endif |
| 649 | return files; |
| 650 | } |
| 651 | |
| 652 | bool sendFilesForTest() |
| 653 | { |