| 28 | namespace obe::Utils::File |
| 29 | { |
| 30 | std::vector<std::string> getDirectoryList(const std::string& path) |
| 31 | { |
| 32 | Debug::Log->trace("<FileUtils> Get Directory List at {0}", path); |
| 33 | std::vector<std::string> folderList; |
| 34 | #ifdef _USE_FILESYSTEM_FALLBACK |
| 35 | tinydir_dir dir; |
| 36 | tinydir_open(&dir, path.c_str()); |
| 37 | |
| 38 | while (dir.has_next) |
| 39 | { |
| 40 | tinydir_file file; |
| 41 | tinydir_readfile(&dir, &file); |
| 42 | if (file.is_dir && std::string(file.name) != "." |
| 43 | && std::string(file.name) != "..") |
| 44 | { |
| 45 | folderList.push_back(std::string(file.name)); |
| 46 | } |
| 47 | tinydir_next(&dir); |
| 48 | } |
| 49 | tinydir_close(&dir); |
| 50 | #else |
| 51 | for (auto& p : std::filesystem::directory_iterator(path)) |
| 52 | { |
| 53 | if (std::filesystem::is_directory(p)) |
| 54 | { |
| 55 | folderList.push_back(std::filesystem::path(p.path()).filename().string()); |
| 56 | } |
| 57 | } |
| 58 | #endif |
| 59 | return folderList; |
| 60 | } |
| 61 | |
| 62 | std::vector<std::string> getFileList(const std::string& path) |
| 63 | { |
no test coverage detected