mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 01:58:19 +00:00
check for case sensitive filename when trying to open a file for reading under windows. Closes #126
This commit is contained in:
parent
ff3eda23ae
commit
2a570196ef
|
@ -262,7 +262,23 @@ int mem_check_imp()
|
|||
IOHANDLE io_open(const char *filename, int flags)
|
||||
{
|
||||
if(flags == IOFLAG_READ)
|
||||
{
|
||||
#if defined(CONF_FAMILY_WINDOWS)
|
||||
// check for filename case sensitive
|
||||
WIN32_FIND_DATA finddata;
|
||||
HANDLE handle;
|
||||
int length;
|
||||
|
||||
length = str_length(filename);
|
||||
if(!filename || !length || filename[length-1] == '\\')
|
||||
return 0x0;
|
||||
handle = FindFirstFile(filename, &finddata);
|
||||
if(handle == INVALID_HANDLE_VALUE || str_comp(filename+length-str_length(finddata.cFileName), finddata.cFileName))
|
||||
return 0x0;
|
||||
FindClose(handle);
|
||||
#endif
|
||||
return (IOHANDLE)fopen(filename, "rb");
|
||||
}
|
||||
if(flags == IOFLAG_WRITE)
|
||||
return (IOHANDLE)fopen(filename, "wb");
|
||||
return 0x0;
|
||||
|
|
Loading…
Reference in a new issue