summaryrefslogtreecommitdiff
path: root/src/shared/util.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/shared/util.cpp')
-rw-r--r--src/shared/util.cpp13
1 files changed, 13 insertions, 0 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;