Fix handling of dCpy with resource fork

DiskCopy disk images on HFS volumes, such as the ByteWorks Opus ][
CD-ROM, have resource forks.  The double-click handler was screening
out forked files, so double-clicking on one of these disk images
was popping open the file viewer instead of creating a new instance
of CiderPress.
This commit is contained in:
Andy McFadden 2015-01-23 10:18:47 -08:00
parent beb4f605d9
commit 4d85f31f0f
1 changed files with 19 additions and 2 deletions

View File

@ -1458,6 +1458,8 @@ GenericEntry* MainWindow::GetSelectedItem(ContentList* pContentList)
void MainWindow::HandleDoubleClick(void)
{
const uint32_t kTypeDimg = 0x64496d67;
const uint32_t kCreatorDcpy = 0x64437079;
bool handled = false;
ASSERT(fpContentList != NULL);
@ -1549,14 +1551,29 @@ void MainWindow::HandleDoubleClick(void)
TmpExtractAndOpen(pEntry, GenericEntry::kDataThread, kModeAppleSingle);
handled = true;
} else
if (fileType == 0x64496d67 && auxType == 0x64437079 &&
pEntry->GetUncompressedLen() == 819284)
if (fileType == kTypeDimg && auxType == kCreatorDcpy &&
pEntry->GetDataForkLen() == 819284)
{
/* type is dImg, creator is dCpy, length is 800K + DC stuff */
LOGI(" Looks like a DiskCopy disk image");
TmpExtractAndOpen(pEntry, GenericEntry::kDataThread, kModeDiskImage);
handled = true;
}
} else if (pEntry->GetRecordKind() == GenericEntry::kRecordKindForkedFile) {
/*
* On Mac HFS volumes these can have resource forks (which we ignore).
* We could probably just generally ignore resource forks for all of
* the above files, rather than pulling this one out separately, but
* this is the only one that could reasonably have a resource fork.
*/
if (fileType == kTypeDimg && auxType == kCreatorDcpy &&
pEntry->GetDataForkLen() == 819284)
{
/* type is dImg, creator is dCpy, length is 800K + DC stuff */
LOGI(" Looks like a (forked) DiskCopy disk image");
TmpExtractAndOpen(pEntry, GenericEntry::kDataThread, kModeDiskImage);
handled = true;
}
} else if (pEntry->GetRecordKind() == GenericEntry::kRecordKindDisk) {
LOGI(" Opening archived disk image");
TmpExtractAndOpen(pEntry, GenericEntry::kDiskImageThread, kModeDiskImage);