|
49 | 49 | #include <fcntl.h> |
50 | 50 | #include <io.h> |
51 | 51 | #else |
52 | | -#include <dirent.h> |
53 | 52 | #include <sys/ioctl.h> |
54 | 53 | #include <sys/stat.h> |
55 | 54 | #include <unistd.h> |
@@ -855,43 +854,6 @@ bool fs_create_directory_with_parents(const std::string & path) { |
855 | 854 | #endif // _WIN32 |
856 | 855 | } |
857 | 856 |
|
858 | | - |
859 | | -std::vector<std::string> fs_list_files(const std::string & folder, const std::string & ext) { |
860 | | - std::vector<std::string> files; |
861 | | - // Note: once we can use C++17 this becomes: |
862 | | - // for (const auto & entry : std::filesystem::directory_iterator(folder)) |
863 | | - // if (entry.path().extension() == ext) files.push_back(entry.path().string()); |
864 | | -#ifdef _WIN32 |
865 | | - std::string search_path = folder + "\\*" + ext; |
866 | | - WIN32_FIND_DATA fd; |
867 | | - HANDLE hFind = ::FindFirstFile(search_path.c_str(), &fd); |
868 | | - if (hFind != INVALID_HANDLE_VALUE) { |
869 | | - do { |
870 | | - if (!(fd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)) { |
871 | | - files.push_back(folder + "\\" + fd.cFileName); |
872 | | - } |
873 | | - } while (::FindNextFile(hFind, &fd)); |
874 | | - ::FindClose(hFind); |
875 | | - } |
876 | | -#else |
877 | | - DIR* dir = opendir(folder.c_str()); |
878 | | - if (dir != nullptr) { |
879 | | - struct dirent* entry; |
880 | | - while ((entry = readdir(dir)) != nullptr) { |
881 | | - if (entry->d_type == DT_REG) { // If it's a regular file |
882 | | - std::string filename = entry->d_name; |
883 | | - if (filename.length() >= ext.length() && |
884 | | - filename.compare(filename.length() - ext.length(), ext.length(), ext) == 0) { |
885 | | - files.push_back(folder + "/" + filename); |
886 | | - } |
887 | | - } |
888 | | - } |
889 | | - closedir(dir); |
890 | | - } |
891 | | -#endif |
892 | | - return files; |
893 | | -} |
894 | | - |
895 | 857 | std::string fs_get_cache_directory() { |
896 | 858 | std::string cache_directory = ""; |
897 | 859 | auto ensure_trailing_slash = [](std::string p) { |
|
0 commit comments