Correcting acx import from an AppleSingle file to setup binary address correctly. #108

This commit is contained in:
Rob Greene 2023-10-21 13:54:04 -05:00
parent 852fbeb4b3
commit 643de4b4b1
2 changed files with 18 additions and 4 deletions

View File

@ -304,10 +304,13 @@ public class ImportCommand extends ReadWriteDiskCommandOptions {
OverrideFileEntryReader.Builder builder = OverrideFileEntryReader.builder();
builder.filename(Optional.ofNullable(as.getRealName()));
builder.prodosFiletype(fileType);
builder.locked((info.getAccess()&0xc2) != 0xc2); //Unlocked if destroy, rename and write are all enabled
builder.fileData(as.getDataFork());
builder.resourceData(Optional.ofNullable(as.getResourceFork()));
builder.prodosFiletype(fileType);
builder.locked((info.getAccess()&0xc2) != 0xc2); //Unlocked if destory, rename and write are all enabled
if (ProdosFormatDisk.fileTypeNeedsAddress(fileType)) {
builder.binaryAddress(info.getAuxType());
}
builder.auxiliaryType(info.getAuxType());
if (as.getFileDatesInfo() != null) {

View File

@ -1286,7 +1286,7 @@ public class ProdosFormatDisk extends FormattedDisk {
/**
* Locate the associated ProdosFileType.
*/
public static ProdosFileType findFileType(String filetype) {
static ProdosFileType findFileType(String filetype) {
for (int i=0; i<fileTypes.length; i++) {
if (filetype.equalsIgnoreCase(fileTypes[i].getString())) {
return fileTypes[i];
@ -1295,6 +1295,17 @@ public class ProdosFormatDisk extends FormattedDisk {
return null;
}
/**
* Utility method to indicate if this file type needs an address.
*/
public static boolean fileTypeNeedsAddress(String filetype) {
ProdosFileType prodosFileType = findFileType(filetype);
if (prodosFileType != null) {
return prodosFileType.needsAddress();
}
return false;
}
/**
* Returns a list of possible file types. Since the filetype is
* specific to each operating system, a simple String is used.