Changeset 598
- Timestamp:
- Jan 3, 2013, 7:20:51 PM (12 years ago)
- Location:
- AE/installer2/src/net/oni2/aeinstaller
- Files:
-
- 2 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
AE/installer2/src/net/oni2/aeinstaller/AEInstaller.properties
r594 r598 1 1 appname=AE Installer 2 2 appversion=0. 332 appversion=0.40 3 3 4 4 invalidPath.title=Wrong directory -
AE/installer2/src/net/oni2/aeinstaller/AEInstaller2.java
r596 r598 8 8 import java.net.URL; 9 9 import java.util.ResourceBundle; 10 import java.util.TreeSet; 10 11 11 12 import javax.imageio.ImageIO; … … 22 23 import net.oni2.aeinstaller.backend.StuffToRefactorLater; 23 24 import net.oni2.aeinstaller.backend.depot.DepotManager; 25 import net.oni2.aeinstaller.backend.mods.Mod; 24 26 import net.oni2.aeinstaller.backend.oni.Installer; 25 27 import net.oni2.aeinstaller.backend.oni.OniSplit; … … 143 145 } 144 146 } else { 145 Installer.initializeEdition(); 147 // Installer.initializeEdition(); 148 Installer.install(new TreeSet<Mod>()); 146 149 } 147 150 -
AE/installer2/src/net/oni2/aeinstaller/backend/Paths.java
r596 r598 51 51 */ 52 52 public static File getModsPath() { 53 return new File(getInstallerPath(), " mods");53 return new File(getInstallerPath(), "packages"); 54 54 } 55 55 -
AE/installer2/src/net/oni2/aeinstaller/backend/oni/Installer.java
r597 r598 5 5 import java.io.FilenameFilter; 6 6 import java.io.IOException; 7 import java.util.HashMap; 8 import java.util.List; 7 9 import java.util.Scanner; 10 import java.util.TreeSet; 11 import java.util.Vector; 8 12 9 13 import net.oni2.aeinstaller.backend.Paths; 10 14 import net.oni2.aeinstaller.backend.Settings; 11 15 import net.oni2.aeinstaller.backend.Settings.Platform; 16 import net.oni2.aeinstaller.backend.mods.Mod; 12 17 13 18 import org.apache.commons.io.FileUtils; … … 30 35 } 31 36 37 public static void install(TreeSet<Mod> mods) { 38 Vector<File> folders = new Vector<File>(); 39 folders.add(Paths.getVanillaOnisPath()); 40 41 for (Mod m : mods) { 42 File oni = new File(m.getLocalPath(), "oni"); 43 if (oni.exists()) { 44 if (m.hasSeparatePlatformDirs()) { 45 File oniCommon = new File(oni, "common"); 46 File oniMac = new File(oni, "mac_only"); 47 File oniWin = new File(oni, "win_only"); 48 if (oniCommon.exists()) 49 folders.add(oniCommon); 50 if (Settings.getPlatform() == Platform.MACOS 51 && oniMac.exists()) 52 folders.add(oniMac); 53 else if (oniWin.exists()) 54 folders.add(oniWin); 55 } else { 56 folders.add(oni); 57 } 58 } 59 } 60 61 for (File f : Paths.getModsPath().listFiles()) { 62 File oni = new File(f, "oni"); 63 if (oni.exists()) 64 folders.add(oni); 65 } 66 combineBinaryFiles(folders); 67 68 // TODO: bsl() 69 } 70 71 private static void combineBinaryFiles(List<File> srcFolders) { 72 try { 73 createEmptyPath(Paths.getEditionGDF()); 74 HashMap<String, Vector<File>> levels = new HashMap<String, Vector<File>>(); 75 76 for (File path : srcFolders) { 77 for (File levelF : path.listFiles()) { 78 if (!levels.containsKey(levelF.getName().toLowerCase())) 79 levels.put(levelF.getName().toLowerCase(), 80 new Vector<File>()); 81 levels.get(levelF.getName().toLowerCase()).add(levelF); 82 } 83 } 84 85 for (String l : levels.keySet()) { 86 System.out.println("Level " + l); 87 for (File f : levels.get(l)) { 88 System.out.println(" " + f.getPath()); 89 90 } 91 92 OniSplit.importLevel(levels.get(l), 93 new File(Paths.getEditionGDF(), l + ".dat")); 94 95 System.out.println(); 96 } 97 } catch (IOException e) { 98 // TODO Auto-generated catch block 99 e.printStackTrace(); 100 } 101 } 102 32 103 /** 33 104 * Initializes the Edition core … … 36 107 File init = new File(Paths.getTempPath(), "init"); 37 108 try { 38 createEmptyPath(Paths.getEditionGDF());39 109 createEmptyPath(Paths.getVanillaOnisPath()); 40 110 createEmptyPath(init); … … 75 145 vanillaFolder.mkdirs(); 76 146 77 OniSplit.importLevel(f, new File(vanillaFolder, levelName 147 Vector<File> folders = new Vector<File>(); 148 folders.add(f); 149 150 OniSplit.importLevel(folders, new File(vanillaFolder, levelName 78 151 + ".oni")); 79 152 } … … 93 166 FileUtils.copyFile(keyConfVanilla, keyConfEdition); 94 167 95 if (Settings.getPlatform() == Platform.MACOS) {96 // TODO97 // /* On Mac only, set the current GDF to the AE GDF by writing98 // to Oni's global preferences file (thankfully a standard OS X99 // ".plist" XML file).100 // Tests for presence of prefs with [ -f ] before doing anything101 // so it doesn't create a partial prefs file -- just in case102 // user has never103 // run Oni before :-p */104 // string fullAEpath =105 // escapePath(system_complete(".").parent_path().parent_path().string());106 // // get full path for Edition/ (Oni wants folder that107 // *contains* the GDF)108 // string prefsCommand =109 // "[ -f ~/Library/Preferences/com.godgames.oni.plist ] && defaults write com.godgames.oni RetailInstallationPath -string '"110 // + fullAEpath + "'";111 // system(prefsCommand.c_str());112 }113 168 // TODO: FileUtils.deleteDirectory(init); 114 169 } catch (IOException e) { … … 175 230 // TODO ? new File(tempFolder, "TexFix").mkdir(); 176 231 File level0File = new File(level0Folder, f.getName()); 177 // TODO: delete non-moved? 178 if (!level0File.exists()) { 179 if (!f.renameTo(level0File)) { 180 System.err.println("File " + f.getName() 181 + " not moved!"); 182 } 183 } 232 moveFileToTargetOrDelete(f, level0File); 184 233 } 185 234 // Move matching files to *VANILLA*/level0_Characters … … 191 240 || f.getName().startsWith("TRSC") 192 241 || f.getName().startsWith("TRAS")) { 193 File level0FolderCharactersVanilla = new File( 194 level0FolderVanilla, "characters"); 195 File level0FileVanilla = new File( 196 level0FolderCharactersVanilla, f.getName()); 197 moveFileToTargetOrDelete(f, level0FileVanilla); 242 // File level0FolderCharactersVanilla = new File( 243 // level0FolderVanilla, "characters"); 244 // File level0FileVanilla = new File( 245 // level0FolderCharactersVanilla, f.getName()); 246 // moveFileToTargetOrDelete(f, level0FileVanilla); 247 // TODO: does this work? 248 File level0File = new File(level0Folder, f.getName()); 249 moveFileToTargetOrDelete(f, level0File); 198 250 } 199 251 // Move matching files to level0_Sounds … … 225 277 // fix for buggy ONWC overriding 226 278 else if (f.getName().startsWith("ONWC")) { 227 File level0FileVanilla = new File(level0FolderVanilla, 228 f.getName()); 229 moveFileToTargetOrDelete(f, level0FileVanilla); 279 // File level0FileVanilla = new File(level0FolderVanilla, 280 // f.getName()); 281 // moveFileToTargetOrDelete(f, level0FileVanilla); 282 // TODO: does this work? 283 File level0File = new File(level0Folder, f.getName()); 284 moveFileToTargetOrDelete(f, level0File); 230 285 } 231 286 } -
AE/installer2/src/net/oni2/aeinstaller/backend/oni/OniSplit.java
r597 r598 108 108 /** 109 109 * Import given folder to a .dat-file 110 * @param sourceFolder Folder containing .oni-files 111 * @param targetFile Target .dat-file 110 * 111 * @param sourceFolders 112 * Folders containing .oni-files 113 * @param targetFile 114 * Target .dat-file 112 115 */ 113 public static void importLevel( File sourceFolder, File targetFile) {116 public static void importLevel(Vector<File> sourceFolders, File targetFile) { 114 117 Vector<String> cmdLine = getProgramInvocation(); 115 118 cmdLine.add(getImportParam()); 116 cmdLine.add(sourceFolder.getPath()); 119 for (File f : sourceFolders) 120 cmdLine.add(f.getPath()); 117 121 cmdLine.add(targetFile.getPath()); 118 122 // System.out.println(cmdLine.toString());
Note:
See TracChangeset
for help on using the changeset viewer.