summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/shared/util.cpp13
-rw-r--r--src/shared/util.h2
2 files changed, 14 insertions, 1 deletions
diff --git a/src/shared/util.cpp b/src/shared/util.cpp
index e61ae8a6..1c4bf5b6 100644
--- a/src/shared/util.cpp
+++ b/src/shared/util.cpp
@@ -28,6 +28,19 @@ along with Mod Organizer. If not, see <http://www.gnu.org/licenses/>.
namespace MOShared {
+bool FileExists(const std::string &filename)
+{
+ WIN32_FIND_DATAA findData;
+ ZeroMemory(&findData, sizeof(WIN32_FIND_DATAA));
+ HANDLE search = ::FindFirstFileExA(filename.c_str(), FindExInfoStandard, &findData, FindExSearchNameMatch, NULL, 0);
+ if (search == INVALID_HANDLE_VALUE) {
+ return false;
+ } else {
+ FindClose(search);
+ return true;
+ }
+}
+
bool FileExists(const std::wstring &filename)
{
WIN32_FIND_DATAW findData;
diff --git a/src/shared/util.h b/src/shared/util.h
index 80983cb0..4af1fb1e 100644
--- a/src/shared/util.h
+++ b/src/shared/util.h
@@ -30,7 +30,7 @@ namespace MOShared {
static const int MAXPATH_UNICODE = 32767;
-
+bool FileExists(const std::string &filename);
bool FileExists(const std::wstring &filename);
bool FileExists(const std::wstring &searchPath, const std::wstring &filename);