Changeset 596 for AE/installer2/src/net/oni2/aeinstaller/backend
- Timestamp:
- Jan 2, 2013, 6:00:16 PM (12 years ago)
- Location:
- AE/installer2/src/net/oni2/aeinstaller/backend
- Files:
-
- 4 added
- 1 deleted
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
AE/installer2/src/net/oni2/aeinstaller/backend/Settings.java
r594 r596 7 7 import java.io.IOException; 8 8 import java.io.Serializable; 9 import java.io.UnsupportedEncodingException;10 import java.net.URLDecoder;11 9 import java.util.HashMap; 12 10 import java.util.Vector; … … 142 140 143 141 /** 144 * Get the Jar path145 *146 * @return Path147 */148 public static String getJarPath() {149 String jarPath = Settings.class.getProtectionDomain().getCodeSource()150 .getLocation().getPath();151 String decodedPath = null;152 try {153 decodedPath = URLDecoder.decode(jarPath, "UTF-8");154 } catch (UnsupportedEncodingException e) {155 e.printStackTrace();156 }157 return new File(decodedPath).getParentFile().getPath() + "/";158 }159 160 /**161 * Get the preferences path162 *163 * @return Path164 */165 public static String getPrefsPath() {166 return getJarPath();167 }168 169 /**170 * Get the path to store downloaded files171 *172 * @return Download path173 */174 public static String getDownloadPath() {175 return getTempPath() + "oni_aei/";176 }177 178 /**179 * Get the path to store game information data180 *181 * @return Data path182 */183 public static String getDataPath() {184 return getJarPath() + "mods/";185 }186 187 /**188 * Get the systems temp-path189 *190 * @return Path191 */192 public static String getTempPath() {193 return new File(System.getProperty("java.io.tmpdir")).getPath() + "/";194 }195 196 /**197 142 * @return Mod Depot cache filename 198 143 */ 199 public static StringgetDepotCacheFilename() {200 return Settings.getPrefsPath() + "ModDepotCache.xml";201 } 202 203 private static StringgetSettingsFilename() {204 return Settings.getPrefsPath() + "AEI-Settings.xml";144 public static File getDepotCacheFilename() { 145 return new File(Paths.getPrefsPath(), "ModDepotCache.xml"); 146 } 147 148 private static File getSettingsFilename() { 149 return new File(Paths.getPrefsPath(), "AEI-Settings.xml"); 205 150 } 206 151 -
AE/installer2/src/net/oni2/aeinstaller/backend/StuffToRefactorLater.java
r591 r596 1 1 package net.oni2.aeinstaller.backend; 2 2 3 import java.io.File;4 3 5 4 public class StuffToRefactorLater { … … 9 8 */ 10 9 public static boolean verifyRunningDirectory() { 11 File jarPath = new File(Settings.getJarPath()); 12 File parentPath = jarPath.getParentFile().getParentFile(); 13 File gdf = new File(parentPath, "GameDataFolder"); 14 return gdf.exists() && gdf.isDirectory(); 10 return Paths.getVanillaGDF().exists() && Paths.getVanillaGDF().isDirectory(); 15 11 } 16 12 }
Note:
See TracChangeset
for help on using the changeset viewer.