source: java/AEInstaller2-Updater/src/net/oni2/aeinstaller/updater/backend/Paths.java@ 735

Last change on this file since 735 was 734, checked in by alloc, 12 years ago

AEI2 self updater

File size: 1.1 KB
Line 
1package net.oni2.aeinstaller.updater.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() {
18 String jarPath = Paths.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 }
28
29 /**
30 * Get the preferences path
31 *
32 * @return Path
33 */
34 public static File getPrefsPath() {
35 return getInstallerPath();
36 }
37
38 /**
39 * Get the path to store downloaded files
40 *
41 * @return Download path
42 */
43 public static File getDownloadPath() {
44 return new File(getTempPath(), "downloads");
45 }
46
47 /**
48 * Get the systems temp-path
49 *
50 * @return Path
51 */
52 public static File getTempPath() {
53 return new File(System.getProperty("java.io.tmpdir"), "oni_aei");
54 }
55
56}
Note: See TracBrowser for help on using the repository browser.