From 6e464ea251cab63c776ece0b2a356f1498ffa294 Mon Sep 17 00:00:00 2001 From: Thog Date: Wed, 8 Mar 2017 08:17:04 +0100 Subject: Follow Fabric guidelines --- src/main/java/cuchaz/enigma/Main.java | 74 +++++++++++++++++------------------ 1 file changed, 37 insertions(+), 37 deletions(-) (limited to 'src/main/java/cuchaz/enigma/Main.java') 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 @@ * Contributors: * Jeff Martin - initial API and implementation ******************************************************************************/ + package cuchaz.enigma; +import cuchaz.enigma.gui.Gui; + +import javax.swing.*; import java.io.File; import java.util.jar.JarFile; -import javax.swing.UIManager; - -import cuchaz.enigma.gui.Gui; - public class Main { - public static void main(String[] args) throws Exception { - if (System.getProperty("enigma.useSystemLookAndFeel", "true").equals("true")) - UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); - Gui gui = new Gui(); - - // parse command-line args - if (args.length >= 1) { - gui.getController().openJar(new JarFile(getFile(args[0]))); - } - if (args.length >= 2) { - gui.getController().openEnigmaMappings(getFile(args[1])); - } - - // DEBUG - //gui.getController().openDeclaration(new ClassEntry("none/byp")); - } - - private static File getFile(String path) { - // 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)); - } - } - - return new File(path); - } + public static void main(String[] args) throws Exception { + if (System.getProperty("enigma.useSystemLookAndFeel", "true").equals("true")) + UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); + Gui gui = new Gui(); + + // parse command-line args + if (args.length >= 1) { + gui.getController().openJar(new JarFile(getFile(args[0]))); + } + if (args.length >= 2) { + gui.getController().openEnigmaMappings(getFile(args[1])); + } + + // DEBUG + //gui.getController().openDeclaration(new ClassEntry("none/byp")); + } + + private static File getFile(String path) { + // 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)); + } + } + + return new File(path); + } } -- cgit v1.2.3