From 2a14640eb32889a2782848ab994ec04925bb68d2 Mon Sep 17 00:00:00 2001 From: Rob Greene Date: Sun, 26 Jun 2022 09:22:25 -0500 Subject: [PATCH] Adding pascal area and extended file to known storage types. --- .../storage/os/prodos/ProdosCommonEntry.java | 29 +++++++++++++++++++ .../storage/os/prodos/ProdosFileEntry.java | 11 ++++--- .../util/ShrinkItUtilities.java | 4 +-- .../ProdosFileEntryReaderWriter.java | 4 +-- .../storage/StorageBundle.properties | 2 ++ 5 files changed, 42 insertions(+), 8 deletions(-) diff --git a/lib/ac-api/src/main/java/com/webcodepro/applecommander/storage/os/prodos/ProdosCommonEntry.java b/lib/ac-api/src/main/java/com/webcodepro/applecommander/storage/os/prodos/ProdosCommonEntry.java index 75eb576..57a7468 100644 --- a/lib/ac-api/src/main/java/com/webcodepro/applecommander/storage/os/prodos/ProdosCommonEntry.java +++ b/lib/ac-api/src/main/java/com/webcodepro/applecommander/storage/os/prodos/ProdosCommonEntry.java @@ -162,6 +162,35 @@ public class ProdosCommonEntry { setStorageType(0x03); } + /** + * Indicates if this is a "pascal area". + */ + public boolean isPascalArea() { + return getStorageType() == 0x04; + } + + /** + * Sets the storage type to a "pascal area". + */ + public void setPascalArea() { + setStorageType(0x04); + } + + /** + * Indicates if this is an "extended" file (GS/OS with resource and data forks). + */ + public boolean isExtendedFile() { + return getStorageType() == 0x05; + } + + /** + * Sets the storage type to an "extended" file (GS/OS with resource and data forks). + */ + public void setExtendedFile() { + setStorageType(0x05); + } + + /** * Indicates if this is a subdirectory entry. */ diff --git a/lib/ac-api/src/main/java/com/webcodepro/applecommander/storage/os/prodos/ProdosFileEntry.java b/lib/ac-api/src/main/java/com/webcodepro/applecommander/storage/os/prodos/ProdosFileEntry.java index d2e10e6..5690729 100644 --- a/lib/ac-api/src/main/java/com/webcodepro/applecommander/storage/os/prodos/ProdosFileEntry.java +++ b/lib/ac-api/src/main/java/com/webcodepro/applecommander/storage/os/prodos/ProdosFileEntry.java @@ -504,10 +504,13 @@ public class ProdosFileEntry extends ProdosCommonEntry implements FileEntry { } list.add(AppleUtil.getFormattedWord(getHeaderPointer())); list.add(AppleUtil.getFormattedWord(getKeyPointer())); - list.add(isSaplingFile() ? textBundle.get("ProdosFileEntry.Sapling") : //$NON-NLS-1$ - isSeedlingFile() ? textBundle.get("ProdosFileEntry.Seedling") : //$NON-NLS-1$ - isTreeFile() ? textBundle.get("ProdosFileEntry.Tree") : //$NON-NLS-1$ - textBundle.format("ProdosFileEntry.UnknownFileType", getFileTypeString())); //$NON-NLS-1$ + list.add(isSaplingFile() ? textBundle.get("ProdosFileEntry.Sapling") : + isSeedlingFile() ? textBundle.get("ProdosFileEntry.Seedling") : + isTreeFile() ? textBundle.get("ProdosFileEntry.Tree") : + isPascalArea() ? textBundle.get("ProdosFileEntry.PascalArea") : + isExtendedFile() ? textBundle.get("ProdosFileEntry.Extended") : + isDirectory() ? textBundle.get("ProdosFileEntry.Directory") : + textBundle.format("ProdosFileEntry.UnknownFileType", getFileTypeString())); list.add(hasChanged() ? textBundle.get("ProdosFileEntry.Changed") : ""); //$NON-NLS-1$//$NON-NLS-2$ numberFormat.setMinimumIntegerDigits(1); diff --git a/lib/ac-api/src/main/java/com/webcodepro/applecommander/util/ShrinkItUtilities.java b/lib/ac-api/src/main/java/com/webcodepro/applecommander/util/ShrinkItUtilities.java index d9ebb92..2928cd1 100644 --- a/lib/ac-api/src/main/java/com/webcodepro/applecommander/util/ShrinkItUtilities.java +++ b/lib/ac-api/src/main/java/com/webcodepro/applecommander/util/ShrinkItUtilities.java @@ -143,9 +143,9 @@ public class ShrinkItUtilities if (resourceFork != null) { // If we have a resource fork in addition to a data fork, - // then we've got a GSOS storage type $5. + // then we've got a GSOS extended storage type $5. newFile.setFileData(readThread(dataFork), readThread(resourceFork)); - newFile.setStorageType(0x05); + newFile.setExtendedFile(); } else { diff --git a/lib/ac-api/src/main/java/com/webcodepro/applecommander/util/readerwriter/ProdosFileEntryReaderWriter.java b/lib/ac-api/src/main/java/com/webcodepro/applecommander/util/readerwriter/ProdosFileEntryReaderWriter.java index a55d089..9b02b89 100644 --- a/lib/ac-api/src/main/java/com/webcodepro/applecommander/util/readerwriter/ProdosFileEntryReaderWriter.java +++ b/lib/ac-api/src/main/java/com/webcodepro/applecommander/util/readerwriter/ProdosFileEntryReaderWriter.java @@ -75,9 +75,9 @@ public class ProdosFileEntryReaderWriter implements FileEntryReader, FileEntryWr public void setFileData(byte[] data, byte[] resource) { try { // If we have a resource fork in addition to a data fork, - // then we've got a GSOS storage type $5. + // then we've got a GSOS extended storage type $5. fileEntry.setFileData(data, resource); - fileEntry.setStorageType(0x05); + fileEntry.setExtendedFile(); } catch (DiskFullException e) { throw new RuntimeException(e); } diff --git a/lib/ac-api/src/main/resources/com/webcodepro/applecommander/storage/StorageBundle.properties b/lib/ac-api/src/main/resources/com/webcodepro/applecommander/storage/StorageBundle.properties index 04b730b..a003c82 100644 --- a/lib/ac-api/src/main/resources/com/webcodepro/applecommander/storage/StorageBundle.properties +++ b/lib/ac-api/src/main/resources/com/webcodepro/applecommander/storage/StorageBundle.properties @@ -119,6 +119,8 @@ ProdosFileEntry.Directory=Directory ProdosFileEntry.Sapling=Sapling ProdosFileEntry.Seedling=Seedling ProdosFileEntry.Tree=Tree +ProdosFileEntry.PascalArea=Pascal Area +ProdosFileEntry.Extended=Extended ProdosFileEntry.UnknownFileType=Unknown ({0}) ProdosFileEntry.Changed=Changed