| 67 | |
| 68 | |
| 69 | static void appendEntries(std::vector<std::string>& entries, const fs::path& dir, int depth) { |
| 70 | try { |
| 71 | for (const auto& entry : fs::directory_iterator(dir)) { |
| 72 | entries.push_back(entry.path().generic_u8string()); |
| 73 | // Recurse if depth > 0 (limited recursion) or depth < 0 (infinite recursion). |
| 74 | if (depth != 0) { |
| 75 | if (entry.is_directory()) { |
| 76 | appendEntries(entries, entry.path(), depth - 1); |
| 77 | } |
| 78 | } |
| 79 | } |
| 80 | } |
| 81 | catch (fs::filesystem_error& e) {} |
| 82 | } |
| 83 | |
| 84 | |
| 85 | std::vector<std::string> getEntries(const std::string& dirPath, int depth) { |