aboutsummaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorPaweł Kołodziejski2002-09-02 20:53:12 +0000
committerPaweł Kołodziejski2002-09-02 20:53:12 +0000
commitbb6bff1b5ec7c8898f5b7f908e7cdb04ff4141eb (patch)
tree9eec3b2a030d00ade3aeaa965177abe07c717fb7 /common
parent687e82c0fa0811b7217c036597befb70662c2bd3 (diff)
downloadscummvm-rg350-bb6bff1b5ec7c8898f5b7f908e7cdb04ff4141eb.tar.gz
scummvm-rg350-bb6bff1b5ec7c8898f5b7f908e7cdb04ff4141eb.tar.bz2
scummvm-rg350-bb6bff1b5ec7c8898f5b7f908e7cdb04ff4141eb.zip
corrected lower/upper changes in File
svn-id: r4898
Diffstat (limited to 'common')
-rw-r--r--common/file.cpp18
1 files changed, 14 insertions, 4 deletions
diff --git a/common/file.cpp b/common/file.cpp
index 0872e6ef56..ecb05cd4a0 100644
--- a/common/file.cpp
+++ b/common/file.cpp
@@ -39,22 +39,32 @@ bool File::open(const char *filename, int mode, byte encbyte) {
}
clearReadFailed();
+
+ int32 i = 0, pos = 0;
+
strcpy(buf, filename);
+ while (buf[i] != 0) {
+ if ((buf[i] == '/') || (buf[i] == '\\')) {
+ pos = i + 1;
+ }
+ i++;
+ }
+
if (mode == 1) {
_handle = fopen(buf, "rb");
if (_handle == NULL) {
- ptr = buf;
+ ptr = buf + pos;
do
*ptr++ = toupper(*ptr);
while (*ptr);
- _handle = fopen(buf, "rb");
+ _handle = fopen(buf + pos, "rb");
}
if (_handle == NULL) {
- ptr = buf;
+ ptr = buf + pos;
do
*ptr++ = tolower(*ptr);
while (*ptr);
- _handle = fopen(buf, "rb");
+ _handle = fopen(buf + pos, "rb");
}
if (_handle == NULL) {
debug(2, "File %s not found", filename);