aboutsummaryrefslogtreecommitdiff
path: root/common/macresman.cpp
diff options
context:
space:
mode:
authorMatthew Hoops2012-03-08 08:02:06 -0500
committerMatthew Hoops2012-03-08 08:02:06 -0500
commit1e734ab48caa842335d0283443614c8dd3f2750a (patch)
treea0d3f6f0d12ac83976891fc9209f4ae2ca2fc8c0 /common/macresman.cpp
parent7cb82f5e126bd2e3a14ab30d86df35be5c236ba5 (diff)
downloadscummvm-rg350-1e734ab48caa842335d0283443614c8dd3f2750a.tar.gz
scummvm-rg350-1e734ab48caa842335d0283443614c8dd3f2750a.tar.bz2
scummvm-rg350-1e734ab48caa842335d0283443614c8dd3f2750a.zip
COMMON: Add an exists function to MacResManager
Diffstat (limited to 'common/macresman.cpp')
-rw-r--r--common/macresman.cpp21
1 files changed, 21 insertions, 0 deletions
diff --git a/common/macresman.cpp b/common/macresman.cpp
index 1317600cb7..14bdfa7080 100644
--- a/common/macresman.cpp
+++ b/common/macresman.cpp
@@ -238,6 +238,27 @@ bool MacResManager::open(FSNode path, String filename) {
return false;
}
+bool MacResManager::exists(const String &filename) {
+ // Try the file name by itself
+ if (Common::File::exists(filename))
+ return true;
+
+ // Try the .rsrc extension
+ if (Common::File::exists(filename + ".rsrc"))
+ return true;
+
+ // Check if we have a MacBinary file
+ Common::File tempFile;
+ if (tempFile.open(filename + ".bin") && isMacBinary(tempFile))
+ return true;
+
+ // Check if we have an AppleDouble file
+ if (tempFile.open("._" + filename) && tempFile.readUint32BE() == 0x00051607)
+ return true;
+
+ return false;
+}
+
bool MacResManager::loadFromAppleDouble(SeekableReadStream &stream) {
if (stream.readUint32BE() != 0x00051607) // tag
return false;