Changeset 776
Legend:
- Unmodified
- Added
- Removed
-
java/ProgramSettings/src/net/oni2/SettingsManager.java
r726 r776 9 9 import java.util.HashMap; 10 10 11 12 11 import com.thoughtworks.xstream.XStream; 13 12 import com.thoughtworks.xstream.io.xml.StaxDriver; … … 25 24 26 25 private static boolean debugRun = false; 26 private static boolean useWorkingDir = false; 27 27 28 28 private HashMap<String, Object> prefs = new HashMap<String, Object>(); … … 55 55 public static boolean isDebug() { 56 56 return debugRun; 57 } 58 59 /** 60 * @param useWd 61 * Use working directory instead of jar path 62 */ 63 public static void setUseWorkingDir(boolean useWd) { 64 useWorkingDir = useWd; 65 } 66 67 /** 68 * @return Do we want to use working directory 69 */ 70 public static boolean getUseWorkingDir() { 71 return useWorkingDir; 57 72 } 58 73 -
java/installer2/src/net/oni2/aeinstaller/AEInstaller2.java
r772 r776 116 116 117 117 boolean debug = false; 118 boolean useWd = false; 118 119 boolean noCacheUpdate = false; 119 120 boolean offline = false; … … 125 126 if (a.equalsIgnoreCase("-offline")) 126 127 offline = true; 128 if (a.equalsIgnoreCase("-usewd")) 129 useWd = true; 127 130 } 128 131 if (!debug) { … … 140 143 SettingsManager.deserializeFromFile(Paths.getSettingsFilename()); 141 144 SettingsManager.setDebug(debug); 145 SettingsManager.setUseWorkingDir(useWd); 142 146 SettingsManager.getInstance().setNoCacheUpdateMode(noCacheUpdate); 143 147 … … 257 261 try { 258 262 int x = svn.checkSVN("http://svn.aei.oni2.net", 259 new File(Paths.getPrefsPath(), "bin"));263 Paths.getJarPath()); 260 264 if (x > 0) { 261 265 // Update available or missing files -
java/installer2/src/net/oni2/aeinstaller/backend/Paths.java
r730 r776 32 32 */ 33 33 public static File getInstallerPath() { 34 if (SettingsManager.isDebug() ) {34 if (SettingsManager.isDebug() || SettingsManager.getUseWorkingDir()) { 35 35 String wd = System.getProperty("user.dir"); 36 36 return new File(wd); 37 37 } else { 38 String jarPath = Paths.class.getProtectionDomain() 39 .getCodeSource().getLocation().getPath(); 40 String decodedPath = null; 41 try { 42 decodedPath = URLDecoder.decode(jarPath, "UTF-8"); 43 } catch (UnsupportedEncodingException e) { 44 e.printStackTrace(); 45 } 46 return new File(decodedPath).getParentFile().getParentFile(); 38 return getJarPath(); 47 39 } 40 } 41 42 /** 43 * @return Path of jar 44 */ 45 public static File getJarPath() { 46 String jarPath = Paths.class.getProtectionDomain().getCodeSource() 47 .getLocation().getPath(); 48 String decodedPath = null; 49 try { 50 decodedPath = URLDecoder.decode(jarPath, "UTF-8"); 51 } catch (UnsupportedEncodingException e) { 52 e.printStackTrace(); 53 } 54 return new File(decodedPath).getParentFile().getParentFile(); 48 55 } 49 56 … … 108 115 */ 109 116 public static File getVanillaGDF() { 110 return CaseInsensitiveFile.getCaseInsensitiveFile(getOniBasePath(), "GameDataFolder"); 117 return CaseInsensitiveFile.getCaseInsensitiveFile(getOniBasePath(), 118 "GameDataFolder"); 111 119 } 112 120
Note:
See TracChangeset
for help on using the changeset viewer.