From b53a6ba61c23982debdaa9562b6416375ebbc2d9 Mon Sep 17 00:00:00 2001 From: Date: Thu, 11 Oct 2012 11:54:56 +0000 Subject: [PATCH] Allow extraction to a file name for -e and -g --- .../webcodepro/applecommander/ui/UiBundle.properties | 2 +- src/com/webcodepro/applecommander/ui/ac.java | 12 ++++++++---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/com/webcodepro/applecommander/ui/UiBundle.properties b/src/com/webcodepro/applecommander/ui/UiBundle.properties index 0da3501..200dea6 100644 --- a/src/com/webcodepro/applecommander/ui/UiBundle.properties +++ b/src/com/webcodepro/applecommander/ui/UiBundle.properties @@ -102,7 +102,7 @@ CreateDirectoryMenuItem=Create Directory... CommandLineErrorMessage = Error: {0} CommandLineNoMatchMessage = {0}: No match. CommandLineStatus = {0} format; {1} bytes free; {2} bytes used. -CommandLineHelp = AppleCommander command line options [{0}]:\n-i [] display information about image(s).\n-ls [] list brief directory of image(s).\n-l [] list directory of image(s).\n-ll [] list detailed directory of image(s).\n-e export file from image to stdout.\n-x [] extract all files from image to directory.\n-g get raw file from image to stdout.\n-p [[$|0x]] put stdin\n in filename on image, using file type and address [0x2000].\n-d delete file from image.\n-k lock file on image.\n-u unlock file on image.\n-n change volume name (ProDOS or Pascal).\n-cc65 put stdin with cc65 header\n in filename on image, using file type and address from header.\n-geos interpret stdin as a GEOS conversion file and\n place it on image (ProDOS only).\n-dos140 create a 140K DOS 3.3 image.\n-pro140 create a 140K ProDOS image.\n-pro800 create an 800K ProDOS image.\n-pas140 create a 140K Pascal image.\n-pas800 create an 800K Pascal image.\n-convert [] uncompress a ShrinkIt or Binary\n II file; or convert a DiskCopy 4.2 image into a ProDOS disk image. +CommandLineHelp = CommandLineHelp = AppleCommander command line options [{0}]:\n-i [] display information about image(s).\n-ls [] list brief directory of image(s).\n-l [] list directory of image(s).\n-ll [] list detailed directory of image(s).\n-e [] export file from image to stdout\n or to an output file.\n-x [] extract all files from image to directory.\n-g [] get raw file from image to stdout\n or to an output file.\n-p [[$|0x]] put stdin\n in filename on image, using file type and address [0x2000].\n-d delete file from image.\n-k lock file on image.\n-u unlock file on image.\n-n change volume name (ProDOS or Pascal).\n-cc65 put stdin with cc65 header\n in filename on image, using file type and address from header.\n-geos interpret stdin as a GEOS conversion file and\n place it on image (ProDOS only).\n-dos140 create a 140K DOS 3.3 image.\n-pro140 create a 140K ProDOS image.\n-pro800 create an 800K ProDOS image.\n-pas140 create a 140K Pascal image.\n-pas800 create an 800K Pascal image.\n-convert [] uncompress a ShrinkIt or Binary\n II file; or convert a DiskCopy 4.2 image into a ProDOS disk image. CommandLineSDKReadOnly = SDK, SHK, and DC42 files are read-only. Use the convert option on them first. CommandLineDC42Bad = Unable to interpret this DiskCopy 42 image. diff --git a/src/com/webcodepro/applecommander/ui/ac.java b/src/com/webcodepro/applecommander/ui/ac.java index 589797a..ecdf863 100644 --- a/src/com/webcodepro/applecommander/ui/ac.java +++ b/src/com/webcodepro/applecommander/ui/ac.java @@ -61,9 +61,11 @@ import com.webcodepro.applecommander.util.TextBundle; * -ls <imagename> [<imagename>] list brief directory of image(s). * -l <imagename> [<imagename>] list directory of image(s). * -ll <imagename> [<imagename>] list detailed directory of image(s). - * -e <imagename> <filename> export file from image to stdout. + * -e <imagename> <filename> [<output>] export file from image to stdout + * or to an output file. * -x <imagename> [<directory>] extract all files from image to directory. - * -g <imagename> <filename> get raw file from image to stdout. + * -g <imagename> <filename> [<output>] get raw file from image to stdout + * or to an output file. * -p <imagename> <filename> <type> [[$|0x]<addr>] put stdin * in filename on image, using file type and address [0x2000]. * -d <imagename> <filename> delete file from image. @@ -100,11 +102,13 @@ public class ac { } else if ("-ll".equalsIgnoreCase(args[0])) { //$NON-NLS-1$ showDirectory(args, FormattedDisk.FILE_DISPLAY_DETAIL); } else if ("-e".equalsIgnoreCase(args[0])) { //$NON-NLS-1$ - getFile(args[1], args[2], true, System.out); + getFile(args[1], args[2], true, + (args.length > 3 ? new PrintStream(new FileOutputStream(args[3])) : System.out)); } else if ("-x".equalsIgnoreCase(args[0])) { //$NON-NLS-1$ getFiles(args[1], (args.length > 2 ? args[2] : "")); } else if ("-g".equalsIgnoreCase(args[0])) { //$NON-NLS-1$ - getFile(args[1], args[2], false, System.out); + getFile(args[1], args[2], false, + (args.length > 3 ? new PrintStream(new FileOutputStream(args[3])) : System.out)); } else if ("-p".equalsIgnoreCase(args[0])) { //$NON-NLS-1$ putFile(args[1], new Name(args[2]), args[3], (args.length > 4 ? args[4] : "0x2000"));