From: Steve Brokenshire Date: Tue, 31 May 2016 21:32:39 +0000 (+0100) Subject: Replaced use of access function with stat function when using FileExists X-Git-Tag: release-0.02~253 X-Git-Url: http://Server1/repobrowser/?a=commitdiff_plain;h=9a3e6e6e83e505a9d61fa37c50191b9fd180c7f8;p=xestiacalendar%2F.git Replaced use of access function with stat function when using FileExists --- 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);