[Download]: Fix listing of files

This commit is contained in:
Diavolo 2023-01-06 14:09:17 +01:00
parent 1bf8601998
commit 5331f23495
No known key found for this signature in database
GPG Key ID: FA77F074E98D98A5
2 changed files with 3 additions and 7 deletions

View File

@ -466,16 +466,12 @@ namespace Components
std::vector<nlohmann::json> fileList;
const auto path = (*Game::fs_basepath)->current.string / fsGame;
auto list = Utils::IO::ListFiles(path, false);
auto list = FileSystem::GetSysFileList(path.generic_string(), "iwd", false);
list.emplace_back("mod.ff");
for (const auto& file : list)
{
auto filename = path / file;
if (filename.extension() != ".iwd"s) // We don't want to serve other files
{
continue;
}
if (file.find("_svr_") != std::string::npos) // Files that are 'server only' are skipped
{

View File

@ -9,7 +9,7 @@ namespace Utils::IO
bool RemoveFile(const std::string& file);
std::size_t FileSize(const std::string& file);
bool CreateDir(const std::string& dir);
bool DirectoryExists(const std::filesystem::path& file);
bool DirectoryIsEmpty(const std::filesystem::path& file);
bool DirectoryExists(const std::filesystem::path& directory);
bool DirectoryIsEmpty(const std::filesystem::path& directory);
std::vector<std::string> ListFiles(const std::filesystem::path& directory, bool recursive = false);
}