Codechange: Use std::filesystem::exists instead of access. (#12702)

This commit is contained in:
Peter Nelson 2024-05-22 09:23:01 +01:00 committed by GitHub
parent 5bc3723bcc
commit 19ca4089a1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 2 additions and 2 deletions

View File

@ -16,7 +16,6 @@
#include "tar_type.h"
#ifdef _WIN32
#include <windows.h>
# define access _taccess
#elif defined(__HAIKU__)
#include <Path.h>
#include <storage/FindDirectory.h>
@ -135,7 +134,8 @@ bool FioCheckFileExists(const std::string &filename, Subdirectory subdir)
*/
bool FileExists(const std::string &filename)
{
return access(OTTD2FS(filename).c_str(), 0) == 0;
std::error_code ec;
return std::filesystem::exists(OTTD2FS(filename), ec);
}
/**