Changeset 596 for AE/installer2/src/net/oni2/aeinstaller
- Timestamp:
- Jan 2, 2013, 6:00:16 PM (12 years ago)
- Location:
- AE/installer2/src/net/oni2/aeinstaller
- Files:
-
- 4 added
- 1 deleted
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
AE/installer2/src/net/oni2/aeinstaller/AEInstaller2.java
r594 r596 17 17 import javax.swing.UIManager.LookAndFeelInfo; 18 18 19 import net.oni2.aeinstaller.backend. OniSplit;19 import net.oni2.aeinstaller.backend.Paths; 20 20 import net.oni2.aeinstaller.backend.Settings; 21 21 import net.oni2.aeinstaller.backend.Settings.Platform; 22 22 import net.oni2.aeinstaller.backend.StuffToRefactorLater; 23 23 import net.oni2.aeinstaller.backend.depot.DepotManager; 24 import net.oni2.aeinstaller.backend.oni.Installer; 25 import net.oni2.aeinstaller.backend.oni.OniSplit; 24 26 import net.oni2.aeinstaller.gui.MainWin; 25 27 … … 62 64 */ 63 65 public static void main(String[] args) { 64 new File(Settings.getPrefsPath()).mkdirs();65 new File(Settings.getDownloadPath()).mkdirs();66 Paths.getPrefsPath().mkdirs(); 67 Paths.getDownloadPath().mkdirs(); 66 68 67 69 boolean debug = false; … … 71 73 if (!debug) { 72 74 try { 73 System.setOut(new PrintStream( Settings.getPrefsPath()74 + "aei_output.log"));75 System.setErr(new PrintStream( Settings.getPrefsPath()76 + "aei_error.log"));75 System.setOut(new PrintStream(new File(Paths.getPrefsPath(), 76 "aei_output.log"))); 77 System.setErr(new PrintStream(new File(Paths.getPrefsPath(), 78 "aei_error.log"))); 77 79 } catch (FileNotFoundException e1) { 78 80 e1.printStackTrace(); … … 86 88 Settings.setDebug(debug); 87 89 DepotManager.getInstance().loadFromFile( 88 new File(Settings.getDepotCacheFilename()));90 Settings.getDepotCacheFilename()); 89 91 90 92 SwingJavaBuilder.getConfig().addResourceBundle(imagesBundle); … … 96 98 System.setProperty("networkaddress.cache.ttl", "5"); 97 99 System.setProperty("networkaddress.cache.negative.ttl", "1"); 98 100 99 101 try { 100 102 String laf = Settings.getInstance().get("lookandfeel", … … 120 122 121 123 // TODO 122 System.out.println("JarPath: " + Settings.getJarPath());123 System.out.println("PrefsPath: " + Settings.getPrefsPath());124 System.out.println("DataPath: " + Settings.getDataPath());125 System.out.println("DownPath: " + Settings.getDownloadPath());126 System.out.println("TempPath: " + Settings.getTempPath());124 System.out.println("JarPath: " + Paths.getInstallerPath()); 125 System.out.println("PrefsPath: " + Paths.getPrefsPath()); 126 System.out.println("DataPath: " + Paths.getModsPath()); 127 System.out.println("DownPath: " + Paths.getDownloadPath()); 128 System.out.println("TempPath: " + Paths.getTempPath()); 127 129 System.out.println("ValidPath: " 128 130 + StuffToRefactorLater.verifyRunningDirectory()); … … 130 132 System.out.println("Architect: " + Settings.getArchitecture()); 131 133 System.out.println(".NET: " + OniSplit.isDotNETInstalled()); 134 System.out.println("Globalized:" + Installer.isEditionInitialized()); 132 135 133 136 if (!StuffToRefactorLater.verifyRunningDirectory()) { … … 139 142 return; 140 143 } 144 } else { 145 Installer.initializeEdition(); 141 146 } 142 147 -
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 } -
AE/installer2/src/net/oni2/aeinstaller/gui/MainWin.java
r593 r596 2 2 3 3 import java.awt.Frame; 4 import java.io.File;5 4 import java.util.ArrayList; 6 5 import java.util.Comparator; … … 190 189 private void saveLocalData() { 191 190 Settings.getInstance().serializeToFile(); 192 DepotManager.getInstance().saveToFile( 193 new File(Settings.getDepotCacheFilename())); 191 DepotManager.getInstance().saveToFile(Settings.getDepotCacheFilename()); 194 192 } 195 193 … … 264 262 JOptionPane.INFORMATION_MESSAGE); 265 263 } 266 264 267 265 @SuppressWarnings("unused") 268 266 private void revertSelection() { … … 271 269 JOptionPane.INFORMATION_MESSAGE); 272 270 } 273 274 275 271 276 272 private void modSelection(NodeMod n) {
Note:
See TracChangeset
for help on using the changeset viewer.