From 79bad390517fabe69d6cc607880ac2909490dadf Mon Sep 17 00:00:00 2001 From: kervala Date: Wed, 16 Mar 2016 19:12:34 +0100 Subject: [PATCH] Changed: Use same algorithm as before Windows unicodes fixes (try to open the file instead of checking its attributes) --- code/nel/src/misc/path.cpp | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/code/nel/src/misc/path.cpp b/code/nel/src/misc/path.cpp index b5375e005..b4057e315 100644 --- a/code/nel/src/misc/path.cpp +++ b/code/nel/src/misc/path.cpp @@ -1963,14 +1963,15 @@ bool CFile::createEmptyFile (const std::string& filename) bool CFile::fileExists (const string& filename) { //H_AUTO(FileExists); -#ifdef NL_OS_WINDOWS - DWORD attr = GetFileAttributesW(utf8ToWide(filename)); - // attributes are valid and file is not a directory - if (attr == INVALID_FILE_ATTRIBUTES || (attr & FILE_ATTRIBUTE_DIRECTORY)) return false; - return true; -#else - return access(filename.c_str(), R_OK) != -1; -#endif + FILE *file = nlfopen(filename, "rb"); + + if (file) + { + fclose(file); + return true; + } + + return false; }