]> git.pld-linux.org Git - packages/Azureus.git/blob - Azureus-platform.patch
- 3.0.4.2
[packages/Azureus.git] / Azureus-platform.patch
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
3 @@ -30,8 +30,6 @@
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;
10  
11  import com.aelitis.azureus.core.AzureusCore;
12 @@ -297,141 +295,6 @@
13                 return null;
14         }
15  
16 -  private boolean restartViaEXE(PrintWriter log,
17 -               String exeUpdater,
18 -      String[]  properties,
19 -      String[]  parameters,
20 -      String backupJavaRunString,
21 -      boolean update_only) 
22 -  {
23 -               String azRunner = null;
24 -               File fileRestart = null;
25 -               if (!update_only) {
26 -               try {
27 -                       azRunner = PlatformManagerFactory.getPlatformManager().getApplicationCommandLine();
28 -               } catch (PlatformManagerException e) {
29 -                       // TODO Auto-generated catch block
30 -                       e.printStackTrace();
31 -               }
32 -               }
33 -
34 -               try {
35 -                       int result;
36 -                       AEWin32Access accessor = AEWin32Manager.getAccessor(true);
37 -                       if (accessor == null) {
38 -                               result = -123;
39 -                       } else {
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("\\\"", "") + "\"";
49 -                                       }
50 -                                       s += "\r\n";
51 -                                       s += "start \"\" \"" + azRunner + "\"";
52 -                                       FileUtil.writeBytesAsFile(fileRestart.getAbsolutePath(), s.getBytes());
53 -
54 -                                       result = accessor.shellExecute(null, fileRestart.getAbsolutePath(),
55 -                                                       null, SystemProperties.getApplicationPath(),
56 -                                                       AEWin32Access.SW_SHOWMINIMIZED);
57 -                               } else {
58 -                                       String execEXE = "\"-J" + getClassPath().replaceAll("\\\"", "")
59 -                                                       + "\" ";
60 -
61 -                                       for (int i = 0; i < properties.length; i++) {
62 -                                               execEXE += "\"-J" + properties[i].replaceAll("\\\"", "") + "\" ";
63 -                                       }
64 -
65 -                                       for (int i = 0; i < parameters.length; i++) {
66 -                                               execEXE += " \"" + parameters[i].replaceAll("\\\"", "") + "\"";
67 -                                       }
68 -
69 -                                       log.println("Launch via " + exeUpdater + " params " + execEXE);
70 -                                       result = accessor.shellExecute(null, exeUpdater, execEXE,
71 -                                                       SystemProperties.getApplicationPath(), AEWin32Access.SW_NORMAL);
72 -                               }
73 -                       }
74 -
75 -                       /*
76 -                        * Some results:
77 -                        * 0: OOM
78 -                        * 2: FNF
79 -                        * 3: Path Not Foud
80 -                        * 5: Access Denied (User clicked cancel on admin access dialog)
81 -                        * 8: OOM
82 -                        * 11: Bad Format
83 -                        * 26: Sharing Violation
84 -                        * 27: Association incomplete
85 -                        * 28: DDE Timeout
86 -                        * 29: DDE Fail
87 -                        * 30: DDE Busy
88 -                        * 31: No Association
89 -                        * 32: DLL Not found
90 -                        * >32: OK!
91 -                        */
92 -                       log.println("   -> " + result);
93 -
94 -                       if (result <= 32) {
95 -                               String sErrorReason = "";
96 -                               String key = null;
97 -
98 -                               switch (result) {
99 -                                       case 0:
100 -                                       case 8:
101 -                                               key = "oom";
102 -                                               break;
103 -
104 -                                       case 2:
105 -                                               key = "fnf";
106 -                                               break;
107 -
108 -                                       case 3:
109 -                                               key = "pnf";
110 -                                               break;
111 -
112 -                                       case 5:
113 -                                               key = "denied";
114 -                                               break;
115 -
116 -                                       case 11:
117 -                                               key = "bad";
118 -                                               break;
119 -
120 -                                       case -123:
121 -                                               key = "nowin32";
122 -                                               break;
123 -
124 -                                       default:
125 -                                               sErrorReason = "" + result;
126 -                                               break;
127 -                               }
128 -                               if (key != null) {
129 -                                       sErrorReason = MessageText.getString("restart.error." + key,
130 -                                                       new String[] {
131 -                                                               exeUpdater,
132 -                                                               SystemProperties.getApplicationPath(),
133 -                                                       });
134 -                               }
135 -                               Logger.log(new LogAlert(false, LogAlert.AT_ERROR,
136 -                                               MessageText.getString("restart.error", new String[] {
137 -                                                       sErrorReason
138 -                                               })));
139 -                               return false;
140 -                       }
141 -               } catch (Throwable f) {
142 -
143 -                       f.printStackTrace(log);
144 -
145 -                       return javaSpawn(log, backupJavaRunString);
146 -               }
147 -
148 -               return true;
149 -       }
150 -  
151  
152    // ****************** This code is copied into Restarter / Updater so make changes there too !!!
153    
154 @@ -446,107 +309,9 @@
155      String[]  parameters,
156      boolean update_only) 
157    {
158 -    if(Constants.isOSX){
159 -       
160 -       restartAzureus_OSX(log,mainClass,properties,parameters);
161 -       
162 -    }else if( Constants.isUnix ){
163 -       
164 -       restartAzureus_Unix(log,mainClass,properties,parameters);
165 -      
166 -    }else{
167 -       
168 -       restartAzureus_win32(log,mainClass,properties,parameters,update_only);
169 -    }
170 +       restartAzureus_Unix(log,mainClass,properties,parameters);
171    }
172    
173 -  private void 
174 -  restartAzureus_win32(
175 -      PrintWriter log,
176 -    String    mainClass,
177 -    String[]  properties,
178 -    String[]  parameters,
179 -    boolean    update_only) 
180 -  {
181 -       String exeUpdater = getExeUpdater(log);  // Not for Updater.java
182 -
183 -       String exec;
184 -
185 -               //Classic restart way using Runtime.exec directly on java(w)
186 -               exec = "\"" + JAVA_EXEC_DIR + "javaw\" " + getClassPath() + getLibraryPath();
187 -
188 -               for (int i = 0; i < properties.length; i++) {
189 -                       exec += properties[i] + " ";
190 -               }
191 -
192 -               exec += mainClass;
193 -
194 -               for (int i = 0; i < parameters.length; i++) {
195 -                       exec += " \"" + parameters[i] + "\"";
196 -               }
197 -
198 -               if (exeUpdater != null) {
199 -                       restartViaEXE(log, exeUpdater, properties, parameters, exec, update_only);
200 -               } else {
201 -                       if (log != null) {
202 -                               log.println("  " + exec);
203 -                       }
204 -
205 -                       if (!win32NativeRestart(log, exec)) {
206 -                               javaSpawn(log, exec);
207 -                       }
208 -               }
209 -       }
210 -  
211 -
212 -       private boolean
213 -       javaSpawn(
214 -               PrintWriter log, 
215 -               String execString) 
216 -       {
217 -               try {
218 -                       // hmm, try java method - this WILL inherit handles but might work :)
219 -
220 -                       log.println("Using java spawn");
221 -
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);
224 -
225 -                       log.println("    -> " + p);
226 -
227 -                       return true;
228 -               } catch (Throwable g) {
229 -
230 -                       g.printStackTrace();
231 -                       return false;
232 -               }
233 -       }
234 -
235 -       private void 
236 -  restartAzureus_OSX(
237 -      PrintWriter log,
238 -    String mainClass,
239 -    String[]  properties,
240 -    String[] parameters) 
241 -  {
242 -
243 -     String exec = "\"" + JAVA_EXEC_DIR + "java\" " + getClassPath() + getLibraryPath();
244 -        
245 -     for (int i=0;i<properties.length;i++){
246 -        exec += properties[i] + " ";
247 -     }
248 -    
249 -     exec += mainClass ;
250 -    
251 -     for(int i = 0 ; i < parameters.length ; i++) {
252 -        exec += " \"" + parameters[i] + "\"";
253 -     }
254 -
255 -     runExternalCommandViaUnixShell( log, exec );
256 -  }
257 -  
258 -  
259 -  
260    private int getUnixScriptVersion() {
261                 String sVersion = System.getProperty("azureus.script.version", "0");
262                 int 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
265 @@ -64,7 +64,6 @@
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;
270  
271  import org.gudy.azureus2.plugins.PluginInterface;
272  import org.gudy.azureus2.plugins.PluginManager;
273 @@ -602,17 +601,6 @@
274          * @param string
275          */
276         private static boolean runInMediaPlayer(String mediaFile) {
277 -               if (Constants.isWindows) {
278 -                       String wmpEXE = Win32Utils.getWMP();
279 -                       if (new File(wmpEXE).exists()) {
280 -                               try {
281 -                                       Runtime.getRuntime().exec(wmpEXE + " \"" + mediaFile + "\"");
282 -                                       return true;
283 -                               } catch (IOException e) {
284 -                                       Debug.out("error playing " + mediaFile + " via WMP " + mediaFile, e);
285 -                               }
286 -                       }
287 -               }
288                 return false;
289         }
290  
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
293 @@ -44,34 +44,8 @@
294                         class_mon.enter();
295                 
296                         if ( platform_manager == null ){
297 -                                                                                 
298 -                               try{
299 -                                       if ( getPlatformType() == PlatformManager.PT_WINDOWS ){
300 -                                               
301 -                                               platform_manager = org.gudy.azureus2.platform.win32.PlatformManagerImpl.getSingleton();
302 -                                               
303 -                                       }else if( getPlatformType() == PlatformManager.PT_MACOSX ){
304 -                                               
305 -                           platform_manager = org.gudy.azureus2.platform.macosx.PlatformManagerImpl.getSingleton();
306 -                           
307 -                                       }else if( getPlatformType() == PlatformManager.PT_UNIX ){
308 -                                               
309 -            platform_manager = org.gudy.azureus2.platform.unix.PlatformManagerImpl.getSingleton();
310 -
311 -                                       }
312 -                               }catch( PlatformManagerException e ){
313 -                                       
314 -                                               // exception will already have been logged
315 -                                       
316 -                               }catch( Throwable e ){
317 -                                       
318 -                                       Debug.printStackTrace(e);
319 -                               }
320 -                       }
321 -                       
322 -                       if ( platform_manager == null ){
323                                 
324 -                               platform_manager = org.gudy.azureus2.platform.dummy.PlatformManagerImpl.getSingleton();
325 +                               platform_manager = org.gudy.azureus2.platform.unix.PlatformManagerImpl.getSingleton();
326                         }
327                         
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
331 @@ -23,7 +23,6 @@
332  import java.util.Properties;
333  
334  import org.gudy.azureus2.platform.unix.PlatformManagerUnixPlugin;
335 -import org.gudy.azureus2.platform.win32.PlatformManagerUpdateChecker;
336  
337  import org.gudy.azureus2.plugins.Plugin;
338  import org.gudy.azureus2.plugins.PluginException;
339 @@ -45,10 +44,7 @@
340                 PlatformManager platform = PlatformManagerFactory.getPlatformManager();
341  
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);
350                 } else {
This page took 0.067438 seconds and 3 git commands to generate.