Merge pull request #704 from diamante0018/develop

[Download]: Fix listing of files
This commit is contained in:
Edo 2023-01-06 13:14:36 +00:00 committed by GitHub
commit a4598db670
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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);
}