Commit bd482eda authored by hybrid's avatar hybrid

Only check for existence of the file to avoid too much disk access.

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@2550 dfc29bdd-3216-0410-991c-e03cc46cb475
parent a117ee31
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
#if !defined ( _WIN32_WCE ) #if !defined ( _WIN32_WCE )
#include <direct.h> // for _chdir #include <direct.h> // for _chdir
#endif #endif
#include <io.h> // for _access
#else #else
#include <unistd.h> #include <unistd.h>
#include <limits.h> #include <limits.h>
...@@ -623,20 +624,14 @@ bool CFileSystem::existFile(const core::string<c16>& filename) const ...@@ -623,20 +624,14 @@ bool CFileSystem::existFile(const core::string<c16>& filename) const
if ( FileArchives[i]->findFile(filename)!=-1) if ( FileArchives[i]->findFile(filename)!=-1)
return true; return true;
_IRR_IMPLEMENT_MANAGED_MARSHALLING_BUGFIX;
#if defined ( _IRR_WCHAR_FILESYSTEM ) #if defined ( _IRR_WCHAR_FILESYSTEM )
FILE* f = _wfopen(filename.c_str(), L"rb"); return (_waccess(filename.c_str(), 0) != -1);
#elif defined(_MSC_VER)
return (_access(filename.c_str(), 0) != -1);
#else #else
FILE* f = fopen(filename.c_str(), "rb"); return (access(filename.c_str(), F_OK) != -1);
#endif #endif
if (f)
{
fclose(f);
return true;
}
_IRR_IMPLEMENT_MANAGED_MARSHALLING_BUGFIX;
return false;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment