Write complete GEOS meta-data to directory entries

This commit is contained in:
2012-04-11 16:17:54 +00:00
parent 199b36d5a6
commit 6b05f34529
2 changed files with 19 additions and 6 deletions

View File

@ -123,12 +123,7 @@ public class ProdosFileEntry extends ProdosCommonEntry implements FileEntry {
if (isDeleted()) { if (isDeleted()) {
AppleUtil.setString(fileEntry, 1, filename.toUpperCase(), 15); AppleUtil.setString(fileEntry, 1, filename.toUpperCase(), 15);
} else { } else {
if (isGEOSFile()) { AppleUtil.setProdosString(fileEntry, 0, filename.toUpperCase(), 15);
// 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);
}
} }
if (isAppleWorksFile()) { if (isAppleWorksFile()) {
byte lowByte = 0; byte lowByte = 0;
@ -147,6 +142,23 @@ public class ProdosFileEntry extends ProdosCommonEntry implements FileEntry {
writeFileEntry(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, * Return the filetype of this file. This will be three characters,
* according to ProDOS - a "$xx" if unknown. * according to ProDOS - a "$xx" if unknown.

View File

@ -755,6 +755,7 @@ public class ProdosFormatDisk extends FormattedDisk {
} else { } else {
setGEOSTreeData(bitmap, fileEntry, fileData); setGEOSTreeData(bitmap, fileEntry, fileData);
} }
fileEntry.setGEOSMeta(headerData);
} }
/** /**