From 6b05f34529b140fe47699f9e7b8865de34535cf4 Mon Sep 17 00:00:00 2001 From: Date: Wed, 11 Apr 2012 16:17:54 +0000 Subject: [PATCH] Write complete GEOS meta-data to directory entries --- .../storage/os/prodos/ProdosFileEntry.java | 24 ++++++++++++++----- .../storage/os/prodos/ProdosFormatDisk.java | 1 + 2 files changed, 19 insertions(+), 6 deletions(-) diff --git a/src/com/webcodepro/applecommander/storage/os/prodos/ProdosFileEntry.java b/src/com/webcodepro/applecommander/storage/os/prodos/ProdosFileEntry.java index 32ff638..19e22bf 100644 --- a/src/com/webcodepro/applecommander/storage/os/prodos/ProdosFileEntry.java +++ b/src/com/webcodepro/applecommander/storage/os/prodos/ProdosFileEntry.java @@ -123,12 +123,7 @@ public class ProdosFileEntry extends ProdosCommonEntry implements FileEntry { if (isDeleted()) { AppleUtil.setString(fileEntry, 1, filename.toUpperCase(), 15); } else { - if (isGEOSFile()) { - // No need to upper-case or be picky about GEOS filenames - AppleUtil.setProdosString(fileEntry, 0, filename, 15); - } else { - AppleUtil.setProdosString(fileEntry, 0, filename.toUpperCase(), 15); - } + AppleUtil.setProdosString(fileEntry, 0, filename.toUpperCase(), 15); } if (isAppleWorksFile()) { byte lowByte = 0; @@ -147,6 +142,23 @@ public class ProdosFileEntry extends ProdosCommonEntry implements FileEntry { writeFileEntry(fileEntry); } + /** + * Copy GEOS-specific metadata to the directory entry verbatim: + * Bytes $00-$10 ($11 bytes) + * Bytes $18-$1d ($06 bytes) + * Bytes $21-$24 ($04 bytes) + */ + public void setGEOSMeta(byte[] metaData) { + byte[] fileEntry = readFileEntry(); + // GEOS metadata lives at $180 offset from the beginning of the first block. + // Copy that to the file entry, skipping the bytes that are locally created + // (i.e. pointers, etc.) + System.arraycopy(metaData,0x180+0x00,fileEntry,0x00,0x11); + System.arraycopy(metaData,0x180+0x18,fileEntry,0x18,0x06); + System.arraycopy(metaData,0x180+0x21,fileEntry,0x21,0x04); + writeFileEntry(fileEntry); + } + /** * Return the filetype of this file. This will be three characters, * according to ProDOS - a "$xx" if unknown. diff --git a/src/com/webcodepro/applecommander/storage/os/prodos/ProdosFormatDisk.java b/src/com/webcodepro/applecommander/storage/os/prodos/ProdosFormatDisk.java index 7249219..04bc760 100644 --- a/src/com/webcodepro/applecommander/storage/os/prodos/ProdosFormatDisk.java +++ b/src/com/webcodepro/applecommander/storage/os/prodos/ProdosFormatDisk.java @@ -755,6 +755,7 @@ public class ProdosFormatDisk extends FormattedDisk { } else { setGEOSTreeData(bitmap, fileEntry, fileData); } + fileEntry.setGEOSMeta(headerData); } /**