source: AE/installer2/src/net/oni2/aeinstaller/backend/DotNet.java@ 702

Last change on this file since 702 was 702, checked in by alloc, 12 years ago

AEI2 0.99u:

  • Fixed a few bugs in apply patches
  • Added some log output to apply patches
File size: 2.0 KB
RevLine 
[672]1package net.oni2.aeinstaller.backend;
2
3import java.io.IOException;
4import java.lang.reflect.InvocationTargetException;
5import java.util.Map;
6import java.util.Vector;
7
8import net.oni2.aeinstaller.backend.Settings.Architecture;
9import net.oni2.aeinstaller.backend.Settings.Platform;
[702]10import net.oni2.aeinstaller.backend.appexecution.AppExecution;
11import net.oni2.aeinstaller.backend.appexecution.AppExecutionResult;
[672]12
13/**
14 * @author Christian Illy
15 */
16public class DotNet {
17
18 /**
19 * @return is a .NET implementation installed?
20 */
21 public static boolean isInstalled() {
22 switch (Settings.getPlatform()) {
23 case WIN:
24 try {
25 int view = WinRegistry.KEY_WOW64_32KEY;
26 if (Settings.getArchitecture() == Architecture.AMD64)
27 view = WinRegistry.KEY_WOW64_64KEY;
28
29 Map<String, String> m = WinRegistry
30 .readStringValues(
31 WinRegistry.HKEY_LOCAL_MACHINE,
32 "Software\\Microsoft\\NET Framework Setup\\NDP\\v2.0.50727",
33 view);
34 return m != null;
35 } catch (IllegalArgumentException e) {
36 e.printStackTrace();
37 } catch (IllegalAccessException e) {
38 e.printStackTrace();
39 } catch (InvocationTargetException e) {
40 e.printStackTrace();
41 } catch (Exception e) {
42 if (!e.getMessage()
43 .equals("Registry access not supported (not a Windows OS?)."))
44 e.printStackTrace();
45 }
46 return false;
47 case MACOS:
48 case LINUX:
49 Vector<String> cmd = new Vector<String>();
50 cmd.add("which");
51 cmd.add("mono");
[702]52 AppExecutionResult res = null;
[672]53 try {
54 res = AppExecution.executeAndWait(cmd);
55 } catch (IOException e) {
56 e.printStackTrace();
57 }
58 if (res != null) {
[702]59 if (res.output.get(0).startsWith("/")
60 && res.output.get(0).endsWith("mono")) {
[672]61 return true;
62 }
63 }
64 return false;
65 default:
66 return false;
67 }
68 }
69
70 /**
71 * @return Get the .Net runtime executable name
72 */
73 public static String getRuntimeExe() {
74 if (Settings.getPlatform() != Platform.WIN)
75 return "mono";
76 return "";
77 }
78
79}
Note: See TracBrowser for help on using the repository browser.