diff options
| author | oy <Tom_Adams@web.de> | 2010-06-26 17:53:32 +0200 |
|---|---|---|
| committer | oy <Tom_Adams@web.de> | 2010-06-26 17:53:32 +0200 |
| commit | 2a570196ef7dd66f475a3379b9cc5b6abf915e09 (patch) | |
| tree | e8d4dae2ab9263b1e51569bcf958e8d636e6c5ce /src | |
| parent | ff3eda23ae7608bfc7e9e79bbcb1c9db571ebaa7 (diff) | |
| download | zcatch-2a570196ef7dd66f475a3379b9cc5b6abf915e09.tar.gz zcatch-2a570196ef7dd66f475a3379b9cc5b6abf915e09.zip | |
check for case sensitive filename when trying to open a file for reading under windows. Closes #126
Diffstat (limited to 'src')
| -rw-r--r-- | src/base/system.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/base/system.c b/src/base/system.c index 47893aa3..457b761a 100644 --- a/src/base/system.c +++ b/src/base/system.c @@ -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; |