From 85b3ea9beb5934012280dc0efa475f334dd9a93a Mon Sep 17 00:00:00 2001 From: jeff Date: Tue, 29 Jul 2014 23:12:30 -0400 Subject: added gui/cli loading of jars/mappings gui can save mappings too --- src/cuchaz/enigma/Main.java | 36 +++++++++++++++++++++++++++++------- 1 file changed, 29 insertions(+), 7 deletions(-) (limited to 'src/cuchaz/enigma/Main.java') diff --git a/src/cuchaz/enigma/Main.java b/src/cuchaz/enigma/Main.java index 4842e20..6a300ed 100644 --- a/src/cuchaz/enigma/Main.java +++ b/src/cuchaz/enigma/Main.java @@ -19,16 +19,38 @@ public class Main public static void main( String[] args ) throws Exception { - startGui(); + Gui gui = new Gui(); + + // parse command-line args + if( args.length >= 1 ) + { + gui.getController().openJar( getFile( args[0] ) ); + } + if( args.length >= 2 ) + { + gui.getController().openMappings( getFile( args[1] ) ); + } } - private static void startGui( ) - throws Exception + private static File getFile( String path ) { - // settings - final File jarFile = new File( "/home/jeff/.minecraft/versions/1.7.10/1.7.10.jar" ); + // expand ~ to the home dir + if( path.startsWith( "~" ) ) + { + // get the home dir + File dirHome = new File( System.getProperty( "user.home" ) ); + + // is the path just ~/ or is it ~user/ ? + if( path.startsWith( "~/" ) ) + { + return new File( dirHome, path.substring( 2 ) ); + } + else + { + return new File( dirHome.getParentFile(), path.substring( 1 ) ); + } + } - // start the GUI and tie it to the deobfuscator - new Controller( new Deobfuscator( jarFile ), new Gui() ); + return new File( path ); } } -- cgit v1.2.3