summaryrefslogtreecommitdiff
path: root/src/main/java/cuchaz/enigma/Main.java
diff options
context:
space:
mode:
authorGravatar Thog2017-03-08 08:17:04 +0100
committerGravatar Thog2017-03-08 08:17:04 +0100
commit6e464ea251cab63c776ece0b2a356f1498ffa294 (patch)
tree5ed30c03f5ac4cd2d6877874f5ede576049954f7 /src/main/java/cuchaz/enigma/Main.java
parentDrop unix case style and implement hashCode when equals is overrided (diff)
downloadenigma-fork-6e464ea251cab63c776ece0b2a356f1498ffa294.tar.gz
enigma-fork-6e464ea251cab63c776ece0b2a356f1498ffa294.tar.xz
enigma-fork-6e464ea251cab63c776ece0b2a356f1498ffa294.zip
Follow Fabric guidelines
Diffstat (limited to 'src/main/java/cuchaz/enigma/Main.java')
-rw-r--r--src/main/java/cuchaz/enigma/Main.java74
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
11package cuchaz.enigma; 12package cuchaz.enigma;
12 13
14import cuchaz.enigma.gui.Gui;
15
16import javax.swing.*;
13import java.io.File; 17import java.io.File;
14import java.util.jar.JarFile; 18import java.util.jar.JarFile;
15 19
16import javax.swing.UIManager;
17
18import cuchaz.enigma.gui.Gui;
19
20public class Main { 20public 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}