Changeset 699 for AE/installer2/src/net/oni2
- Timestamp:
- Mar 17, 2013, 6:52:08 PM (12 years ago)
- Location:
- AE/installer2/src/net/oni2/aeinstaller
- Files:
-
- 1 added
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
AE/installer2/src/net/oni2/aeinstaller/AEInstaller.properties
r698 r699 1 1 appname=AE Installer 2 2 appversion=0.99 s2 appversion=0.99t -
AE/installer2/src/net/oni2/aeinstaller/AEInstaller2.java
r672 r699 21 21 import javax.swing.UIManager.LookAndFeelInfo; 22 22 23 import net.oni2.aeinstaller.backend.CaseInsensitiveFile; 23 24 import net.oni2.aeinstaller.backend.DotNet; 24 25 import net.oni2.aeinstaller.backend.Paths; … … 64 65 65 66 private static void initBundles() { 66 File localesDir = newFile(Paths.getInstallerPath(), "locales");67 File localesDir = CaseInsensitiveFile.getCaseInsensitiveFile(Paths.getInstallerPath(), "locales"); 67 68 if (localesDir.isDirectory()) 68 69 addClassPath(localesDir); -
AE/installer2/src/net/oni2/aeinstaller/backend/Paths.java
r625 r699 92 92 */ 93 93 public static File getVanillaGDF() { 94 return newFile(getOniBasePath(), "GameDataFolder");94 return CaseInsensitiveFile.getCaseInsensitiveFile(getOniBasePath(), "GameDataFolder"); 95 95 } 96 96 -
AE/installer2/src/net/oni2/aeinstaller/backend/oni/Installer.java
r698 r699 22 22 23 23 import net.oni2.aeinstaller.AEInstaller2; 24 import net.oni2.aeinstaller.backend.CaseInsensitiveFile; 24 25 import net.oni2.aeinstaller.backend.Paths; 25 26 import net.oni2.aeinstaller.backend.Settings; … … 111 112 /** 112 113 * @param tools 113 * Tools to install 114 * Tools to (un)install 115 * @param uninstall 116 * Uninstall tools or install? 114 117 */ 115 public static void installTools(TreeSet<Package> tools ) {118 public static void installTools(TreeSet<Package> tools, boolean uninstall) { 116 119 TreeSet<Integer> installed = getInstalledTools(); 117 120 for (Package m : tools) { 118 File plain = new File(m.getLocalPath(), "plain"); 119 if (plain.exists()) { 120 if (m.hasSeparatePlatformDirs()) { 121 File plainCommon = new File(plain, "common"); 122 File plainMac = new File(plain, "mac_only"); 123 File plainWin = new File(plain, "win_only"); 124 if (plainCommon.exists()) 125 copyToolsFiles(plainCommon); 126 if (Settings.getPlatform() == Platform.MACOS 127 && plainMac.exists()) 128 copyToolsFiles(plainMac); 129 else if (plainWin.exists()) 130 copyToolsFiles(plainWin); 131 } else { 132 copyToolsFiles(plain); 133 } 134 } 135 installed.add(m.getPackageNumber()); 136 } 137 writeInstalledTools(installed); 138 } 139 140 /** 141 * @param tools 142 * Tools to uninstall 143 */ 144 public static void uninstallTools(TreeSet<Package> tools) { 145 TreeSet<Integer> installed = getInstalledTools(); 146 for (Package m : tools) { 147 if (installed.contains(m.getPackageNumber())) { 148 File plain = new File(m.getLocalPath(), "plain"); 121 if (!uninstall || installed.contains(m.getPackageNumber())) { 122 File plain = CaseInsensitiveFile.getCaseInsensitiveFile( 123 m.getLocalPath(), "plain"); 149 124 if (plain.exists()) { 150 125 if (m.hasSeparatePlatformDirs()) { 151 File plainCommon = new File(plain, "common"); 152 File plainMac = new File(plain, "mac_only"); 153 File plainWin = new File(plain, "win_only"); 126 File plainCommon = CaseInsensitiveFile 127 .getCaseInsensitiveFile(plain, "common"); 128 File plainMac = CaseInsensitiveFile 129 .getCaseInsensitiveFile(plain, "mac_only"); 130 File plainWin = CaseInsensitiveFile 131 .getCaseInsensitiveFile(plain, "win_only"); 154 132 if (plainCommon.exists()) 155 removeToolsFiles(plainCommon,156 Paths.getEditionBasePath() );133 copyRemoveToolsFiles(plainCommon, 134 Paths.getEditionBasePath(), uninstall); 157 135 if (Settings.getPlatform() == Platform.MACOS 158 136 && plainMac.exists()) 159 removeToolsFiles(plainMac,160 Paths.getEditionBasePath() );137 copyRemoveToolsFiles(plainMac, 138 Paths.getEditionBasePath(), uninstall); 161 139 else if (plainWin.exists()) 162 removeToolsFiles(plainWin,163 Paths.getEditionBasePath() );140 copyRemoveToolsFiles(plainWin, 141 Paths.getEditionBasePath(), uninstall); 164 142 } else { 165 removeToolsFiles(plain, Paths.getEditionBasePath()); 143 copyRemoveToolsFiles(plain, Paths.getEditionBasePath(), 144 uninstall); 166 145 } 167 146 } 168 147 } 169 installed.remove(m.getPackageNumber()); 148 if (uninstall) 149 installed.remove(m.getPackageNumber()); 150 else 151 installed.add(m.getPackageNumber()); 170 152 } 171 153 writeInstalledTools(installed); 172 154 } 173 155 174 private static void copyToolsFiles(File srcFolder) { 156 private static void copyRemoveToolsFiles(File srcFolder, File targetFolder, 157 boolean remove) { 175 158 for (File f : srcFolder.listFiles()) { 176 159 try { 177 160 if (f.isDirectory()) 178 FileUtils.copyDirectoryToDirectory(f, 179 Paths.getEditionBasePath()); 180 else 181 FileUtils 182 .copyFileToDirectory(f, Paths.getEditionBasePath()); 161 copyRemoveToolsFiles(f, 162 CaseInsensitiveFile.getCaseInsensitiveFile( 163 targetFolder, f.getName()), remove); 164 else { 165 File targetFile = CaseInsensitiveFile 166 .getCaseInsensitiveFile(targetFolder, 167 f.getName()); 168 if (remove) { 169 if (targetFile.exists()) 170 targetFile.delete(); 171 } else { 172 if (!targetFile.getName().equals(f.getName())) 173 targetFile.delete(); 174 FileUtils.copyFileToDirectory(f, targetFolder); 175 } 176 } 183 177 } catch (IOException e) { 184 178 e.printStackTrace(); 185 179 } 186 180 } 187 } 188 189 private static void removeToolsFiles(File srcFolder, File target) { 190 for (File f : srcFolder.listFiles()) { 191 if (f.isDirectory()) 192 removeToolsFiles(f, new File(target, f.getName())); 193 else { 194 File targetFile = new File(target, f.getName()); 195 if (targetFile.exists()) 196 targetFile.delete(); 197 } 198 } 199 if (target.list().length == 0) 200 target.delete(); 181 if (remove) 182 if (targetFolder.list().length == 0) 183 targetFolder.delete(); 201 184 } 202 185 … … 258 241 } 259 242 })) { 260 File ignore = new File(f, "ignore.txt"); 243 File ignore = CaseInsensitiveFile.getCaseInsensitiveFile(f, 244 "ignore.txt"); 261 245 if (!ignore.exists()) { 262 246 try { … … 283 267 unlockLevels.add(lev); 284 268 285 File oni = new File(m.getLocalPath(), "oni"); 269 File oni = CaseInsensitiveFile.getCaseInsensitiveFile( 270 m.getLocalPath(), "oni"); 286 271 if (oni.exists()) { 287 272 if (m.hasSeparatePlatformDirs()) { 288 File oniCommon = new File(oni, "common"); 289 File oniMac = new File(oni, "mac_only"); 290 File oniWin = new File(oni, "win_only"); 273 File oniCommon = CaseInsensitiveFile 274 .getCaseInsensitiveFile(oni, "common"); 275 File oniMac = CaseInsensitiveFile.getCaseInsensitiveFile( 276 oni, "mac_only"); 277 File oniWin = CaseInsensitiveFile.getCaseInsensitiveFile( 278 oni, "win_only"); 291 279 if (oniCommon.exists()) 292 280 foldersOni.add(oniCommon); … … 301 289 } 302 290 303 File patches = new File(m.getLocalPath(), "patches"); 291 File patches = CaseInsensitiveFile.getCaseInsensitiveFile( 292 m.getLocalPath(), "patches"); 304 293 if (patches.exists()) { 305 294 if (m.hasSeparatePlatformDirs()) { 306 File patchesCommon = new File(patches, "common"); 307 File patchesMac = new File(patches, "mac_only"); 308 File patchesWin = new File(patches, "win_only"); 295 File patchesCommon = CaseInsensitiveFile 296 .getCaseInsensitiveFile(patches, "common"); 297 File patchesMac = CaseInsensitiveFile 298 .getCaseInsensitiveFile(patches, "mac_only"); 299 File patchesWin = CaseInsensitiveFile 300 .getCaseInsensitiveFile(patches, "win_only"); 309 301 if (patchesCommon.exists()) 310 302 foldersPatches.add(patchesCommon); … … 367 359 368 360 for (Package m : mods.descendingSet()) { 369 File bsl = new File(m.getLocalPath(), "bsl"); 361 File bsl = CaseInsensitiveFile.getCaseInsensitiveFile( 362 m.getLocalPath(), "bsl"); 370 363 if (bsl.exists()) { 371 364 if (m.hasSeparatePlatformDirs()) { 372 File bslCommon = new File(bsl, "common"); 373 File bslMac = new File(bsl, "mac_only"); 374 File bslWin = new File(bsl, "win_only"); 365 File bslCommon = CaseInsensitiveFile 366 .getCaseInsensitiveFile(bsl, "common"); 367 File bslMac = CaseInsensitiveFile.getCaseInsensitiveFile( 368 bsl, "mac_only"); 369 File bslWin = CaseInsensitiveFile.getCaseInsensitiveFile( 370 bsl, "win_only"); 375 371 if ((Settings.getPlatform() == Platform.MACOS && bslMac 376 372 .exists()) … … 401 397 402 398 Vector<File> sources = new Vector<File>(); 403 File bsl = new File(sourceMod.getLocalPath(), "bsl"); 399 File bsl = CaseInsensitiveFile.getCaseInsensitiveFile( 400 sourceMod.getLocalPath(), "bsl"); 404 401 if (sourceMod.hasSeparatePlatformDirs()) { 405 File bslCommon = new File(bsl, "common"); 406 File bslMac = new File(bsl, "mac_only"); 407 File bslWin = new File(bsl, "win_only"); 402 File bslCommon = CaseInsensitiveFile.getCaseInsensitiveFile(bsl, 403 "common"); 404 File bslMac = CaseInsensitiveFile.getCaseInsensitiveFile(bsl, 405 "mac_only"); 406 File bslWin = CaseInsensitiveFile.getCaseInsensitiveFile(bsl, 407 "win_only"); 408 408 if (Settings.getPlatform() == Platform.MACOS && bslMac.exists()) { 409 409 for (File f : bslMac.listFiles(dirFileFilter)) { … … 442 442 if (!targetPath.exists()) 443 443 targetPath.mkdir(); 444 if (!(new File(targetPath, "ignore.txt").exists())) { 444 if (!(CaseInsensitiveFile.getCaseInsensitiveFile(targetPath, 445 "ignore.txt").exists())) { 445 446 for (File fbsl : f.listFiles()) { 446 447 if (fbsl.getName().toLowerCase().endsWith(".bsl")) { … … 551 552 e.printStackTrace(); 552 553 } 553 554 554 555 oniLevelFolders.get(level).add(levelFolder); 555 556 } -
AE/installer2/src/net/oni2/aeinstaller/backend/oni/OniSplit.java
r698 r699 5 5 import java.util.Vector; 6 6 7 import net.oni2.aeinstaller.backend.AppExecution; 8 import net.oni2.aeinstaller.backend.CaseInsensitiveFile; 7 9 import net.oni2.aeinstaller.backend.DotNet; 8 10 import net.oni2.aeinstaller.backend.Paths; 9 import net.oni2.aeinstaller.backend.AppExecution;10 11 import net.oni2.aeinstaller.backend.Settings; 11 12 import net.oni2.aeinstaller.backend.Settings.Platform; … … 238 239 239 240 private static File getProgramFile() { 240 return new File(new File(Paths.getEditionBasePath(), "Tools"),241 241 File toolsPath = CaseInsensitiveFile.getCaseInsensitiveFile(Paths.getEditionBasePath(), "Tools"); 242 return CaseInsensitiveFile.getCaseInsensitiveFile(toolsPath, "Onisplit.exe"); 242 243 } 243 244 } -
AE/installer2/src/net/oni2/aeinstaller/backend/oni/XMLTools.java
r698 r699 6 6 7 7 import net.oni2.aeinstaller.backend.AppExecution; 8 import net.oni2.aeinstaller.backend.CaseInsensitiveFile; 8 9 import net.oni2.aeinstaller.backend.DotNet; 9 10 import net.oni2.aeinstaller.backend.Paths; … … 48 49 49 50 private static File getProgramFile() { 50 return new File(new File(Paths.getEditionBasePath(), "Tools"),51 51 File toolsPath = CaseInsensitiveFile.getCaseInsensitiveFile(Paths.getEditionBasePath(), "Tools"); 52 return CaseInsensitiveFile.getCaseInsensitiveFile(toolsPath, "xmlTools.exe"); 52 53 } 53 54 } -
AE/installer2/src/net/oni2/aeinstaller/backend/packages/Mod_Info.java
r672 r699 9 9 import java.util.HashSet; 10 10 11 import net.oni2.aeinstaller.backend.CaseInsensitiveFile; 11 12 import net.oni2.aeinstaller.backend.Paths; 12 13 … … 111 112 } 112 113 } else if (sName.equalsIgnoreCase("ExeName")) { 113 exeFile = newFile(Paths.getEditionBasePath(), sVal);114 exeFile = CaseInsensitiveFile.getCaseInsensitiveFile(Paths.getEditionBasePath(), sVal); 114 115 } else if (sName.equalsIgnoreCase("ExeType")) { 115 116 if (sVal.equalsIgnoreCase("OSBinary")) … … 122 123 workingDir = sVal; 123 124 } else if (sName.equalsIgnoreCase("IconName")) { 124 iconFile = newFile(Paths.getEditionBasePath(), sVal);125 iconFile = CaseInsensitiveFile.getCaseInsensitiveFile(Paths.getEditionBasePath(), sVal); 125 126 } 126 127 } -
AE/installer2/src/net/oni2/aeinstaller/backend/packages/Package.java
r672 r699 14 14 import org.apache.commons.io.FileUtils; 15 15 16 import net.oni2.aeinstaller.backend.CaseInsensitiveFile; 16 17 import net.oni2.aeinstaller.backend.Paths; 17 18 import net.oni2.aeinstaller.backend.Settings; … … 105 106 */ 106 107 public void updateLocalData() { 107 File config = newFile(getLocalPath(), "Mod_Info.cfg");108 File config = CaseInsensitiveFile.getCaseInsensitiveFile(getLocalPath(), "Mod_Info.cfg"); 108 109 File aeicfg = new File(getLocalPath(), "aei.cfg"); 109 File plain = newFile(getLocalPath(), "plain");110 File plain = CaseInsensitiveFile.getCaseInsensitiveFile(getLocalPath(), "plain"); 110 111 if (config.exists()) { 111 112 Mod_Info mi = new Mod_Info(config, packageNumber); -
AE/installer2/src/net/oni2/aeinstaller/gui/MainWin.java
r698 r699 352 352 tools.add(m); 353 353 if (tools.size() > 0) { 354 Installer.installTools(tools );354 Installer.installTools(tools, false); 355 355 } 356 356 } … … 552 552 } 553 553 evt.setProgressMessage(bundle.getString("coreToolsInstall.title")); 554 Installer.installTools(PackageManager.getInstance().getCoreTools() );554 Installer.installTools(PackageManager.getInstance().getCoreTools(), false); 555 555 } 556 556 } … … 701 701 702 702 if (actuallyTools.size() > 0) { 703 Installer.installTools(actuallyTools );703 Installer.installTools(actuallyTools, false); 704 704 } 705 705 } -
AE/installer2/src/net/oni2/aeinstaller/gui/toolmanager/ToolManager.java
r658 r699 96 96 TreeSet<Package> tools = new TreeSet<Package>(); 97 97 tools.add(selectedPackage); 98 Installer. uninstallTools(tools);98 Installer.installTools(tools, true); 99 99 } else { 100 100 if (!selectedPackage.isLocalAvailable()) { … … 122 122 TreeSet<Package> tools = new TreeSet<Package>(); 123 123 tools.add(selectedPackage); 124 Installer.installTools(tools );124 Installer.installTools(tools, false); 125 125 } 126 126 }
Note:
See TracChangeset
for help on using the changeset viewer.