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

Last change on this file since 615 was 602, checked in by alloc, 12 years ago

AEI2

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() {
[602]18// String jarPath = Settings.class.getProtectionDomain().getCodeSource()
19// .getLocation().getPath();
20// String decodedPath = null;
21// try {
22// decodedPath = URLDecoder.decode(jarPath, "UTF-8");
23// } catch (UnsupportedEncodingException e) {
24// e.printStackTrace();
25// }
26// return new File(decodedPath).getParentFile();
27 String wd = System.getProperty("user.dir");
28 return new File(wd);
[596]29 }
30
31 /**
32 * Get the preferences path
33 *
34 * @return Path
35 */
36 public static File getPrefsPath() {
37 return getInstallerPath();
38 }
39
40 /**
41 * Get the path to store downloaded files
42 *
43 * @return Download path
44 */
45 public static File getDownloadPath() {
46 return new File(getTempPath(), "downloads");
47 }
48
49 /**
50 * Get the path to store mods
51 *
52 * @return Data path
53 */
54 public static File getModsPath() {
[598]55 return new File(getInstallerPath(), "packages");
[596]56 }
57
58 /**
59 * Get the path where vanilla .oni-files are stored
60 *
61 * @return Vanilla .oni's path
62 */
63 public static File getVanillaOnisPath() {
64 return new File(getInstallerPath(), "vanilla");
65 }
66
67 /**
68 * Get the base path of Oni
69 *
70 * @return Vanilla Oni path
71 */
72 public static File getOniBasePath() {
73 return getInstallerPath().getParentFile().getParentFile();
74 }
75
76 /**
77 * Get the base path of the Edition
78 *
79 * @return Edition path
80 */
81 public static File getEditionBasePath() {
82 return getInstallerPath().getParentFile();
83 }
84
85 /**
86 * Get the path where the vanilla Oni GDF is located
87 *
88 * @return Vanilla Oni GDF
89 */
90 public static File getVanillaGDF() {
91 return new File(getOniBasePath(), "GameDataFolder");
92 }
93
94 /**
95 * Get the path where the Edition GDF is located
96 *
97 * @return Edition GDF
98 */
99 public static File getEditionGDF() {
100 return new File(getEditionBasePath(), "GameDataFolder");
101 }
102
103 /**
104 * Get the systems temp-path
105 *
106 * @return Path
107 */
108 public static File getTempPath() {
109 return new File(System.getProperty("java.io.tmpdir"), "oni_aei");
110 }
111
112}
Note: See TracBrowser for help on using the repository browser.