diff options
| author | 2015-02-08 21:29:25 -0500 | |
|---|---|---|
| committer | 2015-02-08 21:29:25 -0500 | |
| commit | ed9b5cdfc648e86fd463bfa8d86b94c41671e14c (patch) | |
| tree | 2619bbc7e04dfa3b82f8dfd3b1d31f529766cd4b /src/cuchaz/enigma/Main.java | |
| download | enigma-fork-ed9b5cdfc648e86fd463bfa8d86b94c41671e14c.tar.gz enigma-fork-ed9b5cdfc648e86fd463bfa8d86b94c41671e14c.tar.xz enigma-fork-ed9b5cdfc648e86fd463bfa8d86b94c41671e14c.zip | |
switch all classes to new signature/type system
Diffstat (limited to 'src/cuchaz/enigma/Main.java')
| -rw-r--r-- | src/cuchaz/enigma/Main.java | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/src/cuchaz/enigma/Main.java b/src/cuchaz/enigma/Main.java new file mode 100644 index 0000000..acae94b --- /dev/null +++ b/src/cuchaz/enigma/Main.java | |||
| @@ -0,0 +1,51 @@ | |||
| 1 | /******************************************************************************* | ||
| 2 | * Copyright (c) 2014 Jeff Martin. | ||
| 3 | * All rights reserved. This program and the accompanying materials | ||
| 4 | * are made available under the terms of the GNU Public License v3.0 | ||
| 5 | * which accompanies this distribution, and is available at | ||
| 6 | * http://www.gnu.org/licenses/gpl.html | ||
| 7 | * | ||
| 8 | * Contributors: | ||
| 9 | * Jeff Martin - initial API and implementation | ||
| 10 | ******************************************************************************/ | ||
| 11 | package cuchaz.enigma; | ||
| 12 | |||
| 13 | import java.io.File; | ||
| 14 | import java.util.jar.JarFile; | ||
| 15 | |||
| 16 | import cuchaz.enigma.gui.Gui; | ||
| 17 | |||
| 18 | public class Main { | ||
| 19 | |||
| 20 | public static void main(String[] args) throws Exception { | ||
| 21 | Gui gui = new Gui(); | ||
| 22 | |||
| 23 | // parse command-line args | ||
| 24 | if (args.length >= 1) { | ||
| 25 | gui.getController().openJar(new JarFile(getFile(args[0]))); | ||
| 26 | } | ||
| 27 | if (args.length >= 2) { | ||
| 28 | gui.getController().openMappings(getFile(args[1])); | ||
| 29 | } | ||
| 30 | |||
| 31 | // DEBUG | ||
| 32 | //gui.getController().openDeclaration(new ClassEntry("none/bxq")); | ||
| 33 | } | ||
| 34 | |||
| 35 | private static File getFile(String path) { | ||
| 36 | // expand ~ to the home dir | ||
| 37 | if (path.startsWith("~")) { | ||
| 38 | // get the home dir | ||
| 39 | File dirHome = new File(System.getProperty("user.home")); | ||
| 40 | |||
| 41 | // is the path just ~/ or is it ~user/ ? | ||
| 42 | if (path.startsWith("~/")) { | ||
| 43 | return new File(dirHome, path.substring(2)); | ||
| 44 | } else { | ||
| 45 | return new File(dirHome.getParentFile(), path.substring(1)); | ||
| 46 | } | ||
| 47 | } | ||
| 48 | |||
| 49 | return new File(path); | ||
| 50 | } | ||
| 51 | } | ||