From 4d85f31f0f0b55c1c9bf3ec85fb8f4c8916978fe Mon Sep 17 00:00:00 2001 From: Andy McFadden Date: Fri, 23 Jan 2015 10:18:47 -0800 Subject: [PATCH] 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. --- app/Main.cpp | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/app/Main.cpp b/app/Main.cpp index 6582345..581c262 100644 --- a/app/Main.cpp +++ b/app/Main.cpp @@ -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);