From f9f76252033e5bfd4884be873cdae9260d00edff Mon Sep 17 00:00:00 2001 From: a2geek Date: Wed, 21 Oct 2026 17:45:47 -0500 Subject: [PATCH] Adding AAF docs and making inspection verify that files were found. --- documentation/aaf-readme.txt | 50 +++++++++++++++++++ .../AppleArchiveFormatFileStoreFactory.java | 6 ++- 2 files changed, 55 insertions(+), 1 deletion(-) create mode 100644 documentation/aaf-readme.txt diff --git a/documentation/aaf-readme.txt b/documentation/aaf-readme.txt new file mode 100644 index 00000000..2f0b37ed --- /dev/null +++ b/documentation/aaf-readme.txt @@ -0,0 +1,50 @@ +Apple Archive Format +Version 1.01 + +COPYRIGHT 1990 by Jonathan A. Chandross. +All Rights Reserved. + +The AAF is a simple archive format designed for shipping around Apple +source code. An archive consists of a series of lines. Each line is +interpreted according to the first character of the line. The +interpretations are: + + = the name of the unpacked file starting here + - a source line to be unpacked into the current file + + end of archive. + +Lines beginning with any other character are simply output to the console. + +A simple example of this format: + From: random@foobar.com + To: freeworld + Subject: First program. + R. + =helloworld.c + -main() + -{ + - printf("Hello World\n"); + -} + =Read.Me + -Test out a C compiler; just compile and execute. + + All done. + J. Random Hacker + random@foobar.com + +This file would create the files "helloworld.c" and "Read.Me". When +the archive was unpacked, all of the non-source and non-file-name +lines would be output to the console until the '+' was encountered. + +Using '=' to specify a file name and '-' to specify a line of source +allows a standard USENET or email file to be unpacked without removing +any preamble or trailing information. + +The '+' at the end of the file indicates the end of an archive. Lines +occurring past this point will not be processed at all. + +The '=' and "+" sentinels are due to Doug Gwyn. + + +Jonathan A. Chandross +jac@paul.rutgers.edu +November 1990 diff --git a/lib/ac-api/src/main/java/org/applecommander/archive/aaf/AppleArchiveFormatFileStoreFactory.java b/lib/ac-api/src/main/java/org/applecommander/archive/aaf/AppleArchiveFormatFileStoreFactory.java index 5cc891d9..06d115fb 100644 --- a/lib/ac-api/src/main/java/org/applecommander/archive/aaf/AppleArchiveFormatFileStoreFactory.java +++ b/lib/ac-api/src/main/java/org/applecommander/archive/aaf/AppleArchiveFormatFileStoreFactory.java @@ -27,7 +27,11 @@ public class AppleArchiveFormatFileStoreFactory implements FileStoreFactory { public void inspect(Context ctx) { DataBuffer data = ctx.source.readAllBytes(); if (data.matches(ch -> (Character.isWhitespace(ch) || (ch >= 0x20 && ch <= 0x7f)))) { - ctx.fileStores.add(new AppleArchiveFormatFileStore(ctx.source)); + // It sort of looks like one; process the file and see if we catch any files! + AppleArchiveFormatFileStore aaf = new AppleArchiveFormatFileStore(ctx.source); + if (!aaf.getRootDirectory().getFiles().isEmpty()) { + ctx.fileStores.add(aaf); + } } } }