From 9f8384349b3a6fee3160ad6f835d7ec7b1b2d93f Mon Sep 17 00:00:00 2001 From: Steve Brokenshire Date: Sun, 17 Jan 2016 09:52:02 +0000 Subject: [PATCH] Implemented FileExists. --- source/common/file.cpp | 23 +++++++++++++++++++++++ source/common/file.h | 9 +++++++++ 2 files changed, 32 insertions(+) create mode 100644 source/common/file.cpp create mode 100644 source/common/file.h diff --git a/source/common/file.cpp b/source/common/file.cpp new file mode 100644 index 0000000..da236b3 --- /dev/null +++ b/source/common/file.cpp @@ -0,0 +1,23 @@ +#include "file.h" + +using namespace std; + +bool FileExists(std::string Filename){ + +#if defined (__WIN32__) + +#else + + const char *FilenameChar = Filename.c_str(); + + int rescode = access(FilenameChar, R_OK); + + if (errno == ENOENT){ + return false; + } + +#endif + + return true; + +} \ No newline at end of file diff --git a/source/common/file.h b/source/common/file.h new file mode 100644 index 0000000..84ca16f --- /dev/null +++ b/source/common/file.h @@ -0,0 +1,9 @@ +#include +#include +#if defined (__WIN32__) + +#else +#include +#endif + +bool FileExists(std::string Filename); \ No newline at end of file -- 2.39.2