bin/dsktool.rb in dsktool-0.1.2 vs bin/dsktool.rb in dsktool-0.1.3
- old
+ new
@@ -1,34 +1,37 @@
#
# dsktool.rb
#
# == Synopsis
#
-# Manipulate DSK format files
+# Manipulate DSK format files (as used by Apple 2 emulators)
#
# == Usage
#
# dsktool.rb [switches] <filename.dsk>
-# -c | --catalog display catalog
+# -c | --log display catalog
# -e | --extract FILENAME extract file by name (either to stdout,
# or file specified by --output)
# -h | --help display this message
# -l | --list FILENAME monitor style listing (disassembles 65C02 opcodes)
# -o | --output FILENAME specify name to save extracted file as
# -x | --explode extract all files
# -v | --version show version number
#
+# Currently only works with DOS 3.3 format
+# DSK images can be
+#
# examples:
-# dsktool.rb -c DOS3MASTR.dsk
+# dsktool.rb -c DOS3MASTR.dsk.gz
# dsktool.rb -l FID DOS3MASTR.dsk
# dsktool.rb --list fid -o fid.asm DOS3MASTR.dsk
# dsktool.rb --extract "COLOR DEMOSOFT" DOS3MASTR.dsk
# dsktool.rb -e HELLO -o HELLO.bas DOS3MASTR.dsk
-# dsktool.rb -x DOS3MASTR.dsk
+# dsktool.rb -x DOS3MASTR.dsk.gz
#
-DSKTOOL_VERSION="0.1.2"
+DSKTOOL_VERSION="0.1.3"
require 'optparse'
require 'rdoc/usage'
#due to a bug in rdoc, tghe Usage won't work correctly when run from a gem executable
@@ -91,14 +94,18 @@
when (output_filename.nil?) then STDOUT
else File.open(output_filename,"wb")
end
if(catalog) then
- dsk.dump_catalog
+ if (dsk.is_dos33?) then
+ dsk.dump_catalog
+ else
+ puts "#{filename} is not in DOS 3.3 format"
+ end
end
if(explode) then
- output_dir=filename.sub(/\.[^.]*$/,"")
+ output_dir=File.basename(filename,".*")
if !(File.exists?(output_dir)) then
Dir.mkdir(output_dir)
end
dsk.files.each_value do |f|