diff options
| author | 2015-01-13 23:25:04 -0500 | |
|---|---|---|
| committer | 2015-01-13 23:25:04 -0500 | |
| commit | 959cb5fd4f9586ec3bd265b452fe25fe1db82e3f (patch) | |
| tree | bdd8a2c52c2fe053ba3460614bde8542e5378dbe /src/cuchaz/enigma/Main.java | |
| parent | got rid of gradle in favor of ivy+ssjb (diff) | |
| download | enigma-fork-959cb5fd4f9586ec3bd265b452fe25fe1db82e3f.tar.gz enigma-fork-959cb5fd4f9586ec3bd265b452fe25fe1db82e3f.tar.xz enigma-fork-959cb5fd4f9586ec3bd265b452fe25fe1db82e3f.zip | |
source format change
don't hate me too much if you were planning a big merge. =P
Diffstat (limited to '')
| -rw-r--r-- | src/cuchaz/enigma/Main.java | 41 |
1 files changed, 16 insertions, 25 deletions
diff --git a/src/cuchaz/enigma/Main.java b/src/cuchaz/enigma/Main.java index 73a12db..f8d3afe 100644 --- a/src/cuchaz/enigma/Main.java +++ b/src/cuchaz/enigma/Main.java | |||
| @@ -14,46 +14,37 @@ import java.io.File; | |||
| 14 | 14 | ||
| 15 | import cuchaz.enigma.gui.Gui; | 15 | import cuchaz.enigma.gui.Gui; |
| 16 | 16 | ||
| 17 | public class Main | 17 | public class Main { |
| 18 | { | 18 | |
| 19 | public static void main( String[] args ) | 19 | public static void main(String[] args) throws Exception { |
| 20 | throws Exception | ||
| 21 | { | ||
| 22 | Gui gui = new Gui(); | 20 | Gui gui = new Gui(); |
| 23 | 21 | ||
| 24 | // parse command-line args | 22 | // parse command-line args |
| 25 | if( args.length >= 1 ) | 23 | if (args.length >= 1) { |
| 26 | { | 24 | gui.getController().openJar(getFile(args[0])); |
| 27 | gui.getController().openJar( getFile( args[0] ) ); | ||
| 28 | } | 25 | } |
| 29 | if( args.length >= 2 ) | 26 | if (args.length >= 2) { |
| 30 | { | 27 | gui.getController().openMappings(getFile(args[1])); |
| 31 | gui.getController().openMappings( getFile( args[1] ) ); | ||
| 32 | } | 28 | } |
| 33 | 29 | ||
| 34 | // DEBUG | 30 | // DEBUG |
| 35 | //gui.getController().openDeclaration( new ClassEntry( "none/ces" ) ); | 31 | // gui.getController().openDeclaration( new ClassEntry( "none/ces" ) ); |
| 36 | } | 32 | } |
| 37 | 33 | ||
| 38 | private static File getFile( String path ) | 34 | private static File getFile(String path) { |
| 39 | { | ||
| 40 | // expand ~ to the home dir | 35 | // expand ~ to the home dir |
| 41 | if( path.startsWith( "~" ) ) | 36 | if (path.startsWith("~")) { |
| 42 | { | ||
| 43 | // get the home dir | 37 | // get the home dir |
| 44 | File dirHome = new File( System.getProperty( "user.home" ) ); | 38 | File dirHome = new File(System.getProperty("user.home")); |
| 45 | 39 | ||
| 46 | // is the path just ~/ or is it ~user/ ? | 40 | // is the path just ~/ or is it ~user/ ? |
| 47 | if( path.startsWith( "~/" ) ) | 41 | if (path.startsWith("~/")) { |
| 48 | { | 42 | return new File(dirHome, path.substring(2)); |
| 49 | return new File( dirHome, path.substring( 2 ) ); | 43 | } else { |
| 50 | } | 44 | return new File(dirHome.getParentFile(), path.substring(1)); |
| 51 | else | ||
| 52 | { | ||
| 53 | return new File( dirHome.getParentFile(), path.substring( 1 ) ); | ||
| 54 | } | 45 | } |
| 55 | } | 46 | } |
| 56 | 47 | ||
| 57 | return new File( path ); | 48 | return new File(path); |
| 58 | } | 49 | } |
| 59 | } | 50 | } |