mirror of
https://port.numenaute.org/aleajactaest/khanat-opennel-code.git
synced 2024-12-24 09:58:46 +00:00
Changed: Use same algorithm as before Windows unicodes fixes (try to open the file instead of checking its attributes)
--HG-- branch : develop
This commit is contained in:
parent
5121cdb7d4
commit
c39190b38d
1 changed files with 9 additions and 8 deletions
|
@ -1963,14 +1963,15 @@ bool CFile::createEmptyFile (const std::string& filename)
|
||||||
bool CFile::fileExists (const string& filename)
|
bool CFile::fileExists (const string& filename)
|
||||||
{
|
{
|
||||||
//H_AUTO(FileExists);
|
//H_AUTO(FileExists);
|
||||||
#ifdef NL_OS_WINDOWS
|
FILE *file = nlfopen(filename, "rb");
|
||||||
DWORD attr = GetFileAttributesW(utf8ToWide(filename));
|
|
||||||
// attributes are valid and file is not a directory
|
if (file)
|
||||||
if (attr == INVALID_FILE_ATTRIBUTES || (attr & FILE_ATTRIBUTE_DIRECTORY)) return false;
|
{
|
||||||
|
fclose(file);
|
||||||
return true;
|
return true;
|
||||||
#else
|
}
|
||||||
return access(filename.c_str(), R_OK) != -1;
|
|
||||||
#endif
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue