diff options
Diffstat (limited to 'src/main/java/cuchaz/enigma/Main.java')
| -rw-r--r-- | src/main/java/cuchaz/enigma/Main.java | 74 |
1 files changed, 37 insertions, 37 deletions
diff --git a/src/main/java/cuchaz/enigma/Main.java b/src/main/java/cuchaz/enigma/Main.java index 7370986..fa8d062 100644 --- a/src/main/java/cuchaz/enigma/Main.java +++ b/src/main/java/cuchaz/enigma/Main.java | |||
| @@ -8,48 +8,48 @@ | |||
| 8 | * Contributors: | 8 | * Contributors: |
| 9 | * Jeff Martin - initial API and implementation | 9 | * Jeff Martin - initial API and implementation |
| 10 | ******************************************************************************/ | 10 | ******************************************************************************/ |
| 11 | |||
| 11 | package cuchaz.enigma; | 12 | package cuchaz.enigma; |
| 12 | 13 | ||
| 14 | import cuchaz.enigma.gui.Gui; | ||
| 15 | |||
| 16 | import javax.swing.*; | ||
| 13 | import java.io.File; | 17 | import java.io.File; |
| 14 | import java.util.jar.JarFile; | 18 | import java.util.jar.JarFile; |
| 15 | 19 | ||
| 16 | import javax.swing.UIManager; | ||
| 17 | |||
| 18 | import cuchaz.enigma.gui.Gui; | ||
| 19 | |||
| 20 | public class Main { | 20 | public class Main { |
| 21 | 21 | ||
| 22 | public static void main(String[] args) throws Exception { | 22 | public static void main(String[] args) throws Exception { |
| 23 | if (System.getProperty("enigma.useSystemLookAndFeel", "true").equals("true")) | 23 | if (System.getProperty("enigma.useSystemLookAndFeel", "true").equals("true")) |
| 24 | UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); | 24 | UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); |
| 25 | Gui gui = new Gui(); | 25 | Gui gui = new Gui(); |
| 26 | 26 | ||
| 27 | // parse command-line args | 27 | // parse command-line args |
| 28 | if (args.length >= 1) { | 28 | if (args.length >= 1) { |
| 29 | gui.getController().openJar(new JarFile(getFile(args[0]))); | 29 | gui.getController().openJar(new JarFile(getFile(args[0]))); |
| 30 | } | 30 | } |
| 31 | if (args.length >= 2) { | 31 | if (args.length >= 2) { |
| 32 | gui.getController().openEnigmaMappings(getFile(args[1])); | 32 | gui.getController().openEnigmaMappings(getFile(args[1])); |
| 33 | } | 33 | } |
| 34 | 34 | ||
| 35 | // DEBUG | 35 | // DEBUG |
| 36 | //gui.getController().openDeclaration(new ClassEntry("none/byp")); | 36 | //gui.getController().openDeclaration(new ClassEntry("none/byp")); |
| 37 | } | 37 | } |
| 38 | 38 | ||
| 39 | private static File getFile(String path) { | 39 | private static File getFile(String path) { |
| 40 | // expand ~ to the home dir | 40 | // expand ~ to the home dir |
| 41 | if (path.startsWith("~")) { | 41 | if (path.startsWith("~")) { |
| 42 | // get the home dir | 42 | // get the home dir |
| 43 | File dirHome = new File(System.getProperty("user.home")); | 43 | File dirHome = new File(System.getProperty("user.home")); |
| 44 | 44 | ||
| 45 | // is the path just ~/ or is it ~user/ ? | 45 | // is the path just ~/ or is it ~user/ ? |
| 46 | if (path.startsWith("~/")) { | 46 | if (path.startsWith("~/")) { |
| 47 | return new File(dirHome, path.substring(2)); | 47 | return new File(dirHome, path.substring(2)); |
| 48 | } else { | 48 | } else { |
| 49 | return new File(dirHome.getParentFile(), path.substring(1)); | 49 | return new File(dirHome.getParentFile(), path.substring(1)); |
| 50 | } | 50 | } |
| 51 | } | 51 | } |
| 52 | 52 | ||
| 53 | return new File(path); | 53 | return new File(path); |
| 54 | } | 54 | } |
| 55 | } | 55 | } |