From 9a3e6e6e83e505a9d61fa37c50191b9fd180c7f8 Mon Sep 17 00:00:00 2001 From: Steve Brokenshire Date: Tue, 31 May 2016 22:32:39 +0100 Subject: [PATCH] Replaced use of access function with stat function when using FileExists --- source/common/file.cpp | 10 ++++------ source/common/file.h | 2 +- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/source/common/file.cpp b/source/common/file.cpp index da236b3..01526d0 100644 --- a/source/common/file.cpp +++ b/source/common/file.cpp @@ -8,16 +8,14 @@ bool FileExists(std::string Filename){ #else - const char *FilenameChar = Filename.c_str(); - - int rescode = access(FilenameChar, R_OK); - - if (errno == ENOENT){ + struct stat BuffData; + + if (stat(Filename.c_str(), &BuffData) == -1){ return false; } #endif - + return true; } \ No newline at end of file diff --git a/source/common/file.h b/source/common/file.h index b986eb5..63c39d3 100644 --- a/source/common/file.h +++ b/source/common/file.h @@ -6,7 +6,7 @@ #if defined (__WIN32__) #else -#include +#include #endif bool FileExists(std::string Filename); -- 2.39.2