Changeset 1078 for java/AEInstaller2-Updater
- Timestamp:
- Oct 16, 2017, 5:31:37 PM (7 years ago)
- Location:
- java/AEInstaller2-Updater/src/net/oni2/aeinstaller/updater
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
java/AEInstaller2-Updater/src/net/oni2/aeinstaller/updater/AEInstaller2Updater.java
r852 r1078 3 3 import java.io.File; 4 4 import java.io.FileNotFoundException; 5 import java.io.FileOutputStream; 5 6 import java.io.PrintStream; 6 7 … … 33 34 if (!debug) { 34 35 try { 35 PrintStream ps = new PrintStream(new File (Paths.getPrefsPath(),36 "updater_output.log")) ;36 PrintStream ps = new PrintStream(new FileOutputStream(new File(Paths.getPrefsPath(), 37 "updater_output.log")), true); 37 38 System.setOut(ps); 38 39 System.setErr(ps); -
java/AEInstaller2-Updater/src/net/oni2/aeinstaller/updater/gui/MainWin.java
r1014 r1078 91 91 } 92 92 } 93 94 System.out.println("Closing AEI updater"); 93 95 dispose(); 94 96 } … … 111 113 112 114 class Updater extends SwingWorker<Status, Status> { 113 boolean uptodate = false; 115 protected void setStep(String text) { 116 step.setText(text); 117 System.out.println(text); 118 } 114 119 115 120 @Override 116 121 protected Status doInBackground() throws Exception { 117 s tep.setText("Waiting for AEI to close");122 setStep("Waiting for AEI to close"); 118 123 int i = 0; 119 124 while (!checkWritable() && i < 20) { … … 128 133 "Could not update because the main file of AEI was locked.\nPerhaps you are still running an instance of AEI?", 129 134 "Could not update!", JOptionPane.ERROR_MESSAGE); 135 System.out.println("Could not update because the main file of AEI was locked."); 130 136 System.exit(1); 131 137 return null; 132 138 } 133 139 134 s tep.setText("Updating");140 setStep("Updating"); 135 141 136 142 SVN svn = new SVN(); 137 143 try { 144 boolean showError = false; 145 138 146 int x = svn.checkSVN("http://svn.aei.oni2.net", 139 147 new File(Paths.getPrefsPath(), "bin")); 140 148 switch (x) { 141 149 case -2: // No repos connection 150 System.out.println("Error: No repository connection"); 151 showError = true; 142 152 break; 143 153 case 0: // Repos up to date 144 uptodate = true;154 System.out.println("AEI up to date"); 145 155 break; 146 156 case -1:// no WC yet 147 157 case 1:// Update available 148 158 case 2:// missing files 149 uptodate = svn.updateWC("http://svn.aei.oni2.net", 159 switch (x) { 160 case -1: 161 System.out.println("No working copy created so far"); 162 break; 163 case 1: 164 System.out.println("Updating to HEAD"); 165 break; 166 case 2: 167 System.out.println("Updating for missing files"); 168 break; 169 } 170 showError = !svn.updateWC("http://svn.aei.oni2.net", 150 171 new File(Paths.getPrefsPath(), "bin"), 151 172 new SVNUpdateListener() { … … 154 175 } 155 176 }); 177 if (showError) { 178 System.out.println("Error: Updating failed!"); 179 } 156 180 break; 157 181 } 158 if ( !uptodate) {182 if (showError) { 159 183 JOptionPane 160 184 .showMessageDialog( … … 198 222 protected void done() { 199 223 super.done(); 200 if (uptodate) { 201 step.setText("AEI is up to date"); 202 bar.setValue(1); 203 bar.setMaximum(1); 204 closeBtn.setEnabled(true); 205 } 224 step.setText("AEI is up to date"); 225 bar.setValue(1); 226 bar.setMaximum(1); 227 closeBtn.setEnabled(true); 206 228 } 207 229 }
Note:
See TracChangeset
for help on using the changeset viewer.