diff options
| author | Tannin <devnull@localhost> | 2013-05-28 23:14:49 +0200 |
|---|---|---|
| committer | Tannin <devnull@localhost> | 2013-05-28 23:14:49 +0200 |
| commit | aadd076269cc3e09896bb1da554bd1a358a276c5 (patch) | |
| tree | 6cd7bfd13012927bbfbc5e5d6b5aafeffd83fe7b /src/shared | |
| parent | d8cb9a4e3710b1a09ac2795541c6b792a917e3a1 (diff) | |
- added hook for ansi version of SHFileOperation, this function may not be routed to the unicode version in every windows variant
Diffstat (limited to 'src/shared')
| -rw-r--r-- | src/shared/util.cpp | 13 | ||||
| -rw-r--r-- | src/shared/util.h | 2 |
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);
|
