source: AE/installer2/src/net/oni2/aeinstaller/backend/Paths.java@ 695

Last change on this file since 695 was 625, checked in by alloc, 12 years ago

AEI2 0.85:

  • Added intro/outro copy and settings
  • Added tool manager dialog (empty for now)
  • AEI uses jar-path as working location again. Only uses workingdirectory if run with -debug now
File size: 2.2 KB
RevLine 
[596]1package net.oni2.aeinstaller.backend;
2
3import java.io.File;
4import java.io.UnsupportedEncodingException;
5import java.net.URLDecoder;
6
7/**
8 * @author Christian Illy
9 */
10public class Paths {
11
12 /**
13 * Get the Jar path
14 *
15 * @return Path
16 */
17 public static File getInstallerPath() {
[625]18 if (Settings.isDebug()) {
19 String wd = System.getProperty("user.dir");
20 return new File(wd);
21 } else {
22 String jarPath = Settings.class.getProtectionDomain()
23 .getCodeSource().getLocation().getPath();
24 String decodedPath = null;
25 try {
26 decodedPath = URLDecoder.decode(jarPath, "UTF-8");
27 } catch (UnsupportedEncodingException e) {
28 e.printStackTrace();
29 }
30 return new File(decodedPath).getParentFile();
31 }
[596]32 }
33
34 /**
35 * Get the preferences path
36 *
37 * @return Path
38 */
39 public static File getPrefsPath() {
40 return getInstallerPath();
41 }
42
43 /**
44 * Get the path to store downloaded files
45 *
46 * @return Download path
47 */
48 public static File getDownloadPath() {
49 return new File(getTempPath(), "downloads");
50 }
51
52 /**
53 * Get the path to store mods
54 *
55 * @return Data path
56 */
57 public static File getModsPath() {
[598]58 return new File(getInstallerPath(), "packages");
[596]59 }
60
61 /**
62 * Get the path where vanilla .oni-files are stored
63 *
64 * @return Vanilla .oni's path
65 */
66 public static File getVanillaOnisPath() {
67 return new File(getInstallerPath(), "vanilla");
68 }
69
70 /**
71 * Get the base path of Oni
72 *
73 * @return Vanilla Oni path
74 */
75 public static File getOniBasePath() {
76 return getInstallerPath().getParentFile().getParentFile();
77 }
78
79 /**
80 * Get the base path of the Edition
81 *
82 * @return Edition path
83 */
84 public static File getEditionBasePath() {
85 return getInstallerPath().getParentFile();
86 }
87
88 /**
89 * Get the path where the vanilla Oni GDF is located
90 *
91 * @return Vanilla Oni GDF
92 */
93 public static File getVanillaGDF() {
94 return new File(getOniBasePath(), "GameDataFolder");
95 }
96
97 /**
98 * Get the path where the Edition GDF is located
99 *
100 * @return Edition GDF
101 */
102 public static File getEditionGDF() {
103 return new File(getEditionBasePath(), "GameDataFolder");
104 }
105
106 /**
107 * Get the systems temp-path
108 *
109 * @return Path
110 */
111 public static File getTempPath() {
112 return new File(System.getProperty("java.io.tmpdir"), "oni_aei");
113 }
114
115}
Note: See TracBrowser for help on using the repository browser.