mirror of
https://github.com/libretro/scummvm.git
synced 2025-04-02 14:51:40 +00:00
COMMON: fix MacResManager native resource forks
These broke in the archive refactor, b8acbe6bee730a9024e73acc769b54285be9afde/#5108, because it removed the ability to directly convert an `ArchiveMember` to an `FSNode`. As a result, it was no longer possible to directly open a resource fork as a stream.
This commit is contained in:
parent
39a496d261
commit
b975da2335
@ -362,6 +362,18 @@ void FSDirectory::cacheDirectoryRecursive(FSNode node, int depth, const Path& pr
|
||||
}
|
||||
} else {
|
||||
_fileCache[name] = *it;
|
||||
|
||||
#ifdef MACOSX
|
||||
// On Mac, check for native resource fork
|
||||
String rsrcName = it->getPath() + "/..namedfork/rsrc";
|
||||
FSNode rsrc = FSNode(rsrcName);
|
||||
|
||||
Path cacheName = prefix.join(it->getRealName() + "/..namedfork/rsrc");
|
||||
|
||||
if (rsrc.exists()) {
|
||||
_fileCache[cacheName] = rsrc;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -274,8 +274,7 @@ bool MacResManager::open(const Path &fileName, Archive &archive) {
|
||||
// Check the actual fork on a Mac computer. It's even worse than __MACOSX as
|
||||
// it's present on any HFS(+) and appears even after copying macbin on HFS(+).
|
||||
const ArchiveMemberPtr archiveMember = archive.getMember(fileName);
|
||||
const Common::FSNode *plainFsNode = dynamic_cast<const Common::FSNode *>(archiveMember.get());
|
||||
if (plainFsNode) {
|
||||
if (archiveMember.get()) {
|
||||
// This could be a MacBinary file that still has a
|
||||
// resource fork; if it is, it needs to get opened as MacBinary
|
||||
// and not treated as raw.
|
||||
@ -286,9 +285,8 @@ bool MacResManager::open(const Path &fileName, Archive &archive) {
|
||||
}
|
||||
delete stream;
|
||||
|
||||
String fullPath = plainFsNode->getPath() + "/..namedfork/rsrc";
|
||||
FSNode resFsNode = FSNode(fullPath);
|
||||
SeekableReadStream *macResForkRawStream = resFsNode.createReadStream();
|
||||
Path fullPath = archiveMember.get()->getPathInArchive().join("/..namedfork/rsrc");
|
||||
SeekableReadStream *macResForkRawStream = archive.createReadStreamForMember(fullPath);
|
||||
if (!isMacBinaryFile && macResForkRawStream && loadFromRawFork(macResForkRawStream)) {
|
||||
_baseFileName = fileName;
|
||||
return true;
|
||||
|
Loading…
x
Reference in New Issue
Block a user