Skip to content

Commit

Permalink
Fix handling of dCpy with resource fork
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
fadden committed Jan 23, 2015
1 parent beb4f60 commit 4d85f31
Showing 1 changed file with 19 additions and 2 deletions.
21 changes: 19 additions & 2 deletions app/Main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 4d85f31

Please sign in to comment.