ripasso-cursive: cosmetic changes (#361736)
[NixPkgs.git] / pkgs / by-name / sc / scorched3d / file-existence.patch
blob35eb63d0702240f4d3766d8fdebef1e396e82779
1 diff --git a/src/common/common/DefinesFile.cpp b/src/common/common/DefinesFile.cpp
2 index 6ad803d..022797a 100644
3 --- a/src/common/common/DefinesFile.cpp
4 +++ b/src/common/common/DefinesFile.cpp
5 @@ -36,6 +36,17 @@
6 #include <unistd.h>
7 #endif
9 +namespace {
10 + bool fileCanBeStated(const std::string &file)
11 + {
12 + struct stat buf;
13 + memset(&buf, 0, sizeof(buf));
14 + int result = stat(file.c_str(), &buf );
16 + return result == 0;
17 + }
20 std::string S3D::getHomeDir()
22 #ifdef _WIN32
23 @@ -74,12 +85,12 @@ bool S3D::dirMake(const std::string &file)
25 bool S3D::fileExists(const std::string &file)
27 - return (S3D::fileModTime(file) != 0);
28 + return fileCanBeStated(file);
31 bool S3D::dirExists(const std::string &file)
33 - return (S3D::fileModTime(file) != 0);
34 + return fileCanBeStated(file);
37 time_t S3D::fileModTime(const std::string &file)