From aadd076269cc3e09896bb1da554bd1a358a276c5 Mon Sep 17 00:00:00 2001 From: Tannin Date: Tue, 28 May 2013 23:14:49 +0200 Subject: - added hook for ansi version of SHFileOperation, this function may not be routed to the unicode version in every windows variant --- src/shared/util.cpp | 13 +++++++++++++ src/shared/util.h | 2 +- 2 files changed, 14 insertions(+), 1 deletion(-) (limited to 'src/shared') 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 . 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); -- cgit v1.3.1