1
0
Fork 0

Codechange: Use std::filesystem::exists instead of access.

pull/12702/head
Peter Nelson 2024-05-20 12:05:03 +01:00
parent fb4a370d3f
commit e0f65b5801
No known key found for this signature in database
GPG Key ID: 8EF8F0A467DF75ED
1 changed files with 2 additions and 2 deletions

View File

@ -16,7 +16,6 @@
#include "tar_type.h" #include "tar_type.h"
#ifdef _WIN32 #ifdef _WIN32
#include <windows.h> #include <windows.h>
# define access _taccess
#elif defined(__HAIKU__) #elif defined(__HAIKU__)
#include <Path.h> #include <Path.h>
#include <storage/FindDirectory.h> #include <storage/FindDirectory.h>
@ -135,7 +134,8 @@ bool FioCheckFileExists(const std::string &filename, Subdirectory subdir)
*/ */
bool FileExists(const std::string &filename) 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);
} }
/** /**