diff options
Diffstat (limited to '')
| -rw-r--r-- | src/cuchaz/enigma/Main.java | 36 |
1 files changed, 29 insertions, 7 deletions
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 | |||
| 19 | public static void main( String[] args ) | 19 | public static void main( String[] args ) |
| 20 | throws Exception | 20 | throws Exception |
| 21 | { | 21 | { |
| 22 | startGui(); | 22 | Gui gui = new Gui(); |
| 23 | |||
| 24 | // parse command-line args | ||
| 25 | if( args.length >= 1 ) | ||
| 26 | { | ||
| 27 | gui.getController().openJar( getFile( args[0] ) ); | ||
| 28 | } | ||
| 29 | if( args.length >= 2 ) | ||
| 30 | { | ||
| 31 | gui.getController().openMappings( getFile( args[1] ) ); | ||
| 32 | } | ||
| 23 | } | 33 | } |
| 24 | 34 | ||
| 25 | private static void startGui( ) | 35 | private static File getFile( String path ) |
| 26 | throws Exception | ||
| 27 | { | 36 | { |
| 28 | // settings | 37 | // expand ~ to the home dir |
| 29 | final File jarFile = new File( "/home/jeff/.minecraft/versions/1.7.10/1.7.10.jar" ); | 38 | if( path.startsWith( "~" ) ) |
| 39 | { | ||
| 40 | // get the home dir | ||
| 41 | File dirHome = new File( System.getProperty( "user.home" ) ); | ||
| 42 | |||
| 43 | // is the path just ~/ or is it ~user/ ? | ||
| 44 | if( path.startsWith( "~/" ) ) | ||
| 45 | { | ||
| 46 | return new File( dirHome, path.substring( 2 ) ); | ||
| 47 | } | ||
| 48 | else | ||
| 49 | { | ||
| 50 | return new File( dirHome.getParentFile(), path.substring( 1 ) ); | ||
| 51 | } | ||
| 52 | } | ||
| 30 | 53 | ||
| 31 | // start the GUI and tie it to the deobfuscator | 54 | return new File( path ); |
| 32 | new Controller( new Deobfuscator( jarFile ), new Gui() ); | ||
| 33 | } | 55 | } |
| 34 | } | 56 | } |