source: java/PlatformTools/src/net/oni2/platformtools/applicationinvoker/Wine.java@ 1077

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

AEI2 0.99y:

  • Perhaps fixes launching Oni on MacOS
File size: 1.3 KB
Line 
1package net.oni2.platformtools.applicationinvoker;
2
3import java.io.File;
4import java.io.IOException;
5import java.util.Vector;
6
7import net.oni2.platformtools.PlatformInformation;
8import net.oni2.platformtools.PlatformInformation.Platform;
9
10/**
11 * @author Christian Illy
12 */
13public class Wine {
14 private static File winePath = null;
15 private static int isInst = -1;
16
17 /**
18 * @return Is Wine installed?
19 */
20 public static boolean isInstalled() {
21 if (isInst < 0)
22 getRuntimeExe();
23 return isInst == 1;
24 }
25
26 /**
27 * @return path to wine, null if not found or not Linux
28 */
29 public static File getRuntimeExe() {
30 if (isInst < 0) {
31 isInst = 0;
32 if (PlatformInformation.getPlatform() == Platform.LINUX) {
33 Vector<String> params = new Vector<String>();
34 params.add("wine");
35 ApplicationInvocationResult res = null;
36 try {
37 res = ApplicationInvoker.executeAndWait(EExeType.OSBINARY,
38 null, new File("which"), params, false);
39 } catch (IOException e) {
40 e.printStackTrace();
41 } catch (ERuntimeNotInstalledException e) {
42 e.printStackTrace();
43 }
44 if (res != null) {
45 if (res.output.size() > 0) {
46 if (res.output.get(0).startsWith("/")
47 && res.output.get(0).endsWith("wine")) {
48 winePath = new File(res.output.get(0));
49 isInst = 1;
50 }
51 }
52 }
53 }
54 }
55 return winePath;
56 }
57}
Note: See TracBrowser for help on using the repository browser.