[Scummvm-cvs-logs] SF.net SVN: scummvm: [21309] scummvm/trunk/common/file.cpp
vinterstum at users.sourceforge.net
vinterstum at users.sourceforge.net
Wed Mar 15 01:42:03 CET 2006
Revision: 21309
Author: vinterstum
Date: 2006-03-15 01:41:22 -0800 (Wed, 15 Mar 2006)
ViewCVS: http://svn.sourceforge.net/scummvm/?rev=21309&view=rev
Log Message:
-----------
Moving the MacOS bundle file checking to another function, it was getting called redundantly.
Modified Paths:
--------------
scummvm/trunk/common/file.cpp
Modified: scummvm/trunk/common/file.cpp
===================================================================
--- scummvm/trunk/common/file.cpp 2006-03-15 07:43:44 UTC (rev 21308)
+++ scummvm/trunk/common/file.cpp 2006-03-15 09:41:22 UTC (rev 21309)
@@ -102,24 +102,6 @@
}
#endif
-// If all else fails, try looking inside the application bundle on MacOS for the lowercase file.
-#ifdef MACOSX
- if (!file) {
- ptr = buf + offsetToFileName;
- while (*ptr) {
- *ptr = tolower(*ptr);
- ptr++;
- }
-
- CFStringRef fileName = CFStringCreateWithBytes(NULL, (const UInt8 *)buf, strlen(buf), kCFStringEncodingASCII, false);
- CFURLRef fileUrl = CFBundleCopyResourceURL(CFBundleGetMainBundle(), fileName, NULL, NULL);
- if (fileUrl) {
- if (CFURLGetFileSystemRepresentation(fileUrl, true, (UInt8 *)buf, sizeof(buf)))
- file = fopen(buf, mode);
- }
- }
-#endif
-
return file;
}
@@ -185,6 +167,21 @@
// Last resort: try the current directory
if (_handle == NULL)
_handle = fopenNoCase(filename, "", modeStr);
+
+ // Last last (really) resort: try looking inside the application bundle on MacOS for the lowercase file.
+#ifdef MACOSX
+ if (!_handle) {
+ CFStringRef cfFileName = CFStringCreateWithBytes(NULL, (const UInt8 *)filename, strlen(filename), kCFStringEncodingASCII, false);
+ CFURLRef fileUrl = CFBundleCopyResourceURL(CFBundleGetMainBundle(), cfFileName, NULL, NULL);
+ if (fileUrl) {
+ UInt8 buf[256];
+ if (CFURLGetFileSystemRepresentation(fileUrl, false, (UInt8 *)buf, 256)) {
+ _handle = fopen((char *)buf, modeStr);
+ }
+ }
+ }
+#endif
+
}
if (_handle == NULL) {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list