Bug in FileSystemHandler::FileExists

Bug in FileSystemHandler::FileExists

Discuss the source code and development of Spring Engine in general from a technical point of view. Patches go here too.

Moderator: Moderators

Post Reply
FluXy
Posts: 4
Joined: 22 Nov 2005, 16:18

Bug in FileSystemHandler::FileExists

Post by FluXy »

Heya,

In spring/rts/System/FileSystem/FileSystem.cpp
in function FileSystemHandler::FileExists
line 252 in current git :

return (_stat(file.c_str(), &info) == 0 && !(info.st_mode & _S_IFREG));

The _S_IFREG means regular file but with the not sign (!) it is reversed and should now always return false if it is a file. It probably got copied from the non windows OS code below which should work fine as it checks if it is a directory.

Simple fix should be to remove the ! sign.

I hope i could help and have fun :)
imbaczek
Posts: 3629
Joined: 22 Aug 2006, 16:19

Re: Bug in FileSystemHandler::FileExists

Post by imbaczek »

thanks, fixed.
Post Reply

Return to “Engine”