Adding some version information and fixing command-line to actually report version.

This commit is contained in:
Rob Greene 2018-04-04 21:34:04 -05:00
parent aafb68f75c
commit 3b04415763
4 changed files with 18 additions and 4 deletions

View File

@ -16,7 +16,9 @@ mainClassName = 'com.webcodepro.shrinkit.NufxScan'
jar { jar {
manifest { manifest {
attributes( attributes(
'Main-Class': mainClassName 'Main-Class': mainClassName,
'Implementation-Title': 'ShrinkItArchive',
'Implementation-Version': version
) )
} }
} }

View File

@ -1,7 +1,7 @@
# Universal ShrinkItArchive version number. Used for: # Universal ShrinkItArchive version number. Used for:
# - Naming JAR file. # - Naming JAR file.
# - The build will insert this into a file that is read at run time as well. # - The build will insert this into a file that is read at run time as well.
version=1.2.1 version=1.2.2
# Maven Central Repository G and A of GAV coordinate. :-) # Maven Central Repository G and A of GAV coordinate. :-)
group=net.sf.applecommander group=net.sf.applecommander

View File

@ -13,6 +13,12 @@ import com.webcodepro.shrinkit.io.LittleEndianByteInputStream;
* @author robgreene@users.sourceforge.net * @author robgreene@users.sourceforge.net
*/ */
public class NuFileArchive { public class NuFileArchive {
public static final String VERSION;
static {
VERSION = NuFileArchive.class.getPackage().getImplementationVersion();
}
private MasterHeaderBlock master; private MasterHeaderBlock master;
private List<HeaderBlock> headers; private List<HeaderBlock> headers;
private long totalSize = 0; private long totalSize = 0;

View File

@ -21,10 +21,16 @@ public class NufxScan {
private static long sizeOfSmallestCompressedFile; private static long sizeOfSmallestCompressedFile;
public static void main(String[] args) throws IOException { public static void main(String[] args) throws IOException {
if (args.length == 0) {
System.out.println("Scan NuFX/Shrinkit archives. Please include at least one path name.");
} else if (args.length == 1 && "-v".equals(args[0])) {
System.out.printf("ShrinkIt Library version %s\n", NuFileArchive.VERSION);
} else {
for (String dir : args) { for (String dir : args) {
scanDirectory(dir); scanDirectory(dir);
} }
} }
}
private static void scanDirectory(String dirName) throws IOException { private static void scanDirectory(String dirName) throws IOException {
File dir = new File(dirName); File dir = new File(dirName);