1 --- Azureus-3.0.3.4/com/aelitis/azureus/core/update/impl/AzureusRestarterImpl.java 2007-11-25 16:13:19.744461541 +0200
2 +++ Azureus-3.0.3.4-new/com/aelitis/azureus/core/update/impl/AzureusRestarterImpl.java 2007-11-25 16:07:36.824808968 +0200
4 import org.gudy.azureus2.platform.PlatformManager;
5 import org.gudy.azureus2.platform.PlatformManagerFactory;
6 import org.gudy.azureus2.platform.unix.ScriptAfterShutdown;
7 -import org.gudy.azureus2.platform.win32.access.AEWin32Access;
8 -import org.gudy.azureus2.platform.win32.access.AEWin32Manager;
9 import org.gudy.azureus2.update.UpdaterUtils;
11 import com.aelitis.azureus.core.AzureusCore;
16 - private boolean restartViaEXE(PrintWriter log,
18 - String[] properties,
19 - String[] parameters,
20 - String backupJavaRunString,
21 - boolean update_only)
23 - String azRunner = null;
24 - File fileRestart = null;
27 - azRunner = PlatformManagerFactory.getPlatformManager().getApplicationCommandLine();
28 - } catch (PlatformManagerException e) {
29 - // TODO Auto-generated catch block
30 - e.printStackTrace();
36 - AEWin32Access accessor = AEWin32Manager.getAccessor(true);
37 - if (accessor == null) {
40 - if (azRunner != null) {
41 - // create a batch file to run the updater, then to restart azureus
42 - // bceause the updater would restart azureus as administrator user
43 - // and confuse the user
44 - fileRestart = FileUtil.getUserFile("restart.bat");
45 - String s = "title Azureus Updater Runner\r\n";
46 - s += exeUpdater + " \"updateonly\"";
47 - for (int i = 1; i < parameters.length; i++) {
48 - s += " \"" + parameters[i].replaceAll("\\\"", "") + "\"";
51 - s += "start \"\" \"" + azRunner + "\"";
52 - FileUtil.writeBytesAsFile(fileRestart.getAbsolutePath(), s.getBytes());
54 - result = accessor.shellExecute(null, fileRestart.getAbsolutePath(),
55 - null, SystemProperties.getApplicationPath(),
56 - AEWin32Access.SW_SHOWMINIMIZED);
58 - String execEXE = "\"-J" + getClassPath().replaceAll("\\\"", "")
61 - for (int i = 0; i < properties.length; i++) {
62 - execEXE += "\"-J" + properties[i].replaceAll("\\\"", "") + "\" ";
65 - for (int i = 0; i < parameters.length; i++) {
66 - execEXE += " \"" + parameters[i].replaceAll("\\\"", "") + "\"";
69 - log.println("Launch via " + exeUpdater + " params " + execEXE);
70 - result = accessor.shellExecute(null, exeUpdater, execEXE,
71 - SystemProperties.getApplicationPath(), AEWin32Access.SW_NORMAL);
80 - * 5: Access Denied (User clicked cancel on admin access dialog)
83 - * 26: Sharing Violation
84 - * 27: Association incomplete
88 - * 31: No Association
92 - log.println(" -> " + result);
95 - String sErrorReason = "";
125 - sErrorReason = "" + result;
129 - sErrorReason = MessageText.getString("restart.error." + key,
132 - SystemProperties.getApplicationPath(),
135 - Logger.log(new LogAlert(false, LogAlert.AT_ERROR,
136 - MessageText.getString("restart.error", new String[] {
141 - } catch (Throwable f) {
143 - f.printStackTrace(log);
145 - return javaSpawn(log, backupJavaRunString);
152 // ****************** This code is copied into Restarter / Updater so make changes there too !!!
154 @@ -446,107 +309,9 @@
158 - if(Constants.isOSX){
160 - restartAzureus_OSX(log,mainClass,properties,parameters);
162 - }else if( Constants.isUnix ){
164 - restartAzureus_Unix(log,mainClass,properties,parameters);
168 - restartAzureus_win32(log,mainClass,properties,parameters,update_only);
170 + restartAzureus_Unix(log,mainClass,properties,parameters);
174 - restartAzureus_win32(
177 - String[] properties,
178 - String[] parameters,
179 - boolean update_only)
181 - String exeUpdater = getExeUpdater(log); // Not for Updater.java
185 - //Classic restart way using Runtime.exec directly on java(w)
186 - exec = "\"" + JAVA_EXEC_DIR + "javaw\" " + getClassPath() + getLibraryPath();
188 - for (int i = 0; i < properties.length; i++) {
189 - exec += properties[i] + " ";
194 - for (int i = 0; i < parameters.length; i++) {
195 - exec += " \"" + parameters[i] + "\"";
198 - if (exeUpdater != null) {
199 - restartViaEXE(log, exeUpdater, properties, parameters, exec, update_only);
202 - log.println(" " + exec);
205 - if (!win32NativeRestart(log, exec)) {
206 - javaSpawn(log, exec);
218 - // hmm, try java method - this WILL inherit handles but might work :)
220 - log.println("Using java spawn");
222 - //NOTE: no logging done here, as we need the method to return right away, before the external process completes
223 - Process p = Runtime.getRuntime().exec(execString);
225 - log.println(" -> " + p);
228 - } catch (Throwable g) {
230 - g.printStackTrace();
236 - restartAzureus_OSX(
239 - String[] properties,
240 - String[] parameters)
243 - String exec = "\"" + JAVA_EXEC_DIR + "java\" " + getClassPath() + getLibraryPath();
245 - for (int i=0;i<properties.length;i++){
246 - exec += properties[i] + " ";
249 - exec += mainClass ;
251 - for(int i = 0 ; i < parameters.length ; i++) {
252 - exec += " \"" + parameters[i] + "\"";
255 - runExternalCommandViaUnixShell( log, exec );
260 private int getUnixScriptVersion() {
261 String sVersion = System.getProperty("azureus.script.version", "0");
263 --- Azureus-3.0.3.4/com/aelitis/azureus/ui/swt/views/skin/TorrentListViewsUtils.java 2007-11-25 16:13:20.004476443 +0200
264 +++ Azureus-3.0.3.4-new/com/aelitis/azureus/ui/swt/views/skin/TorrentListViewsUtils.java 2007-11-25 16:08:41.120493661 +0200
266 import com.aelitis.azureus.ui.swt.views.TorrentListViewListener;
267 import com.aelitis.azureus.util.AdManager;
268 import com.aelitis.azureus.util.Constants;
269 -import com.aelitis.azureus.util.win32.Win32Utils;
271 import org.gudy.azureus2.plugins.PluginInterface;
272 import org.gudy.azureus2.plugins.PluginManager;
276 private static boolean runInMediaPlayer(String mediaFile) {
277 - if (Constants.isWindows) {
278 - String wmpEXE = Win32Utils.getWMP();
279 - if (new File(wmpEXE).exists()) {
281 - Runtime.getRuntime().exec(wmpEXE + " \"" + mediaFile + "\"");
283 - } catch (IOException e) {
284 - Debug.out("error playing " + mediaFile + " via WMP " + mediaFile, e);
291 --- Azureus-3.0.3.4/org/gudy/azureus2/platform/PlatformManagerFactory.java 2007-11-25 16:13:20.840524357 +0200
292 +++ Azureus-3.0.3.4-new/org/gudy/azureus2/platform/PlatformManagerFactory.java 2007-11-25 16:10:50.123886748 +0200
296 if ( platform_manager == null ){
299 - if ( getPlatformType() == PlatformManager.PT_WINDOWS ){
301 - platform_manager = org.gudy.azureus2.platform.win32.PlatformManagerImpl.getSingleton();
303 - }else if( getPlatformType() == PlatformManager.PT_MACOSX ){
305 - platform_manager = org.gudy.azureus2.platform.macosx.PlatformManagerImpl.getSingleton();
307 - }else if( getPlatformType() == PlatformManager.PT_UNIX ){
309 - platform_manager = org.gudy.azureus2.platform.unix.PlatformManagerImpl.getSingleton();
312 - }catch( PlatformManagerException e ){
314 - // exception will already have been logged
316 - }catch( Throwable e ){
318 - Debug.printStackTrace(e);
322 - if ( platform_manager == null ){
324 - platform_manager = org.gudy.azureus2.platform.dummy.PlatformManagerImpl.getSingleton();
325 + platform_manager = org.gudy.azureus2.platform.unix.PlatformManagerImpl.getSingleton();
328 return( platform_manager );
329 --- Azureus-3.0.3.4/org/gudy/azureus2/platform/PlatformManagerPluginDelegate.java 2007-11-25 16:13:20.840524357 +0200
330 +++ Azureus-3.0.3.4-new/org/gudy/azureus2/platform/PlatformManagerPluginDelegate.java 2007-11-25 16:12:12.344598819 +0200
332 import java.util.Properties;
334 import org.gudy.azureus2.platform.unix.PlatformManagerUnixPlugin;
335 -import org.gudy.azureus2.platform.win32.PlatformManagerUpdateChecker;
337 import org.gudy.azureus2.plugins.Plugin;
338 import org.gudy.azureus2.plugins.PluginException;
340 PlatformManager platform = PlatformManagerFactory.getPlatformManager();
342 int platformType = platform.getPlatformType();
343 - if (platformType == PlatformManager.PT_WINDOWS) {
344 - PlatformManagerUpdateChecker plugin = new PlatformManagerUpdateChecker();
345 - plugin.initialize(pluginInterface);
346 - } else if (platformType == PlatformManager.PT_UNIX) {
347 + if (platformType == PlatformManager.PT_UNIX) {
348 PlatformManagerUnixPlugin plugin = new PlatformManagerUnixPlugin();
349 plugin.initialize(pluginInterface);