- Timestamp:
- Mar 30, 2013, 3:04:44 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
java/AEInstaller2-Updater/src/net/oni2/aeinstaller/updater/gui/MainWin.java
r734 r756 14 14 import javax.swing.JFrame; 15 15 import javax.swing.JLabel; 16 import javax.swing.JOptionPane; 16 17 import javax.swing.JProgressBar; 17 18 import javax.swing.SwingWorker; … … 111 112 @Override 112 113 protected Status doInBackground() throws Exception { 113 Thread.sleep(2000); 114 step.setText("Waiting for AEI to close"); 115 int i = 0; 116 while (!checkWritable() && i < 20) { 117 i++; 118 Thread.sleep(500); 119 } 120 121 if (i >= 20) { 122 JOptionPane 123 .showMessageDialog( 124 null, 125 "Could not update because the main file of AEI was locked.\nPerhaps you are still running an instance of AEI?", 126 "Could not update!", JOptionPane.ERROR_MESSAGE); 127 System.exit(1); 128 return null; 129 } 130 114 131 step.setText("Updating"); 115 132 116 133 SVN svn = new SVN(); 117 134 try { … … 132 149 } 133 150 return null; 151 } 152 153 private boolean checkWritable() { 154 File aei = new File(new File(Paths.getInstallerPath(), "bin"), 155 "AEInstaller2.jar"); 156 File temp = new File(new File(Paths.getInstallerPath(), "bin"), 157 "temp.jar"); 158 if (!aei.exists()) 159 return true; 160 if (aei.renameTo(temp)) { 161 temp.renameTo(aei); 162 return true; 163 } 164 return false; 134 165 } 135 166
Note:
See TracChangeset
for help on using the changeset viewer.