author | Eugene Ostroukhov <eugeneo@symbian.org> |
Wed, 27 Jan 2010 17:54:14 -0800 | |
changeset 54 | 5a2cfa9bc743 |
parent 43 | 464130c45935 |
child 55 | bb6160d0b6f2 |
permissions | -rw-r--r-- |
2 | 1 |
/******************************************************************************* |
2 |
* Copyright (c) 2009 Symbian Foundation and/or its subsidiary(-ies). |
|
3 |
* All rights reserved. |
|
4 |
* This component and the accompanying materials are made available |
|
5 |
* under the terms of the License "Eclipse Public License v1.0" |
|
6 |
* which accompanies this distribution, and is available |
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 |
* |
|
9 |
* Initial Contributors: |
|
10 |
* Symbian Foundation - initial contribution. |
|
11 |
* Contributors: |
|
12 |
* Description: |
|
13 |
* Overview: |
|
14 |
* Details: |
|
15 |
* Platforms/Drives/Compatibility: |
|
16 |
* Assumptions/Requirement/Pre-requisites: |
|
17 |
* Failures and causes: |
|
18 |
*******************************************************************************/ |
|
19 |
package org.symbian.tools.wrttools.debug.internal; |
|
20 |
||
21 |
import java.io.File; |
|
22 |
||
23 |
import org.eclipse.core.resources.IProject; |
|
24 |
import org.eclipse.core.runtime.Platform; |
|
54
5a2cfa9bc743
Nature is used for UI
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
43
diff
changeset
|
25 |
import org.symbian.tools.wrttools.util.ProjectUtils; |
2 | 26 |
|
27 |
public final class ChromeDebugUtils { |
|
28 |
public static String getExecutablePath(String folder) { |
|
29 |
File file = new File(folder); |
|
30 |
if (file.isDirectory()) { |
|
31 |
File chromeExecutable = new File(file, getExecutable()); |
|
32 |
if (chromeExecutable.isFile()) { |
|
33 |
return chromeExecutable.getAbsolutePath(); |
|
34 |
} |
|
35 |
} |
|
36 |
return null; |
|
37 |
} |
|
38 |
||
39 |
private static String getExecutable() { |
|
40 |
// Add more ifs as we add support for new platforms |
|
41 |
if (isMac()) { |
|
42 |
return "Google Chrome.app/Contents/MacOS/Google Chrome"; |
|
43
464130c45935
Linux support, first cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
2
diff
changeset
|
43 |
} if (isLinux()) { |
464130c45935
Linux support, first cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
2
diff
changeset
|
44 |
return "chrome"; |
2 | 45 |
} else { |
46 |
return "chrome.exe"; |
|
47 |
} |
|
48 |
} |
|
49 |
||
50 |
private ChromeDebugUtils() { |
|
51 |
// No instantiating |
|
52 |
} |
|
53 |
||
54 |
public static String getChromeExecutible() { |
|
55 |
return getExecutablePath(Activator.getDefault().getPreferenceStore().getString(IConstants.PREF_NAME_CHROME_LOCATION)); |
|
56 |
} |
|
57 |
||
58 |
public static boolean isWindows() { |
|
59 |
return "windows".equals(Platform.getOS()); |
|
60 |
} |
|
61 |
||
62 |
public static boolean isMac() { |
|
63 |
return "macosx".equals(Platform.getOS()); |
|
64 |
} |
|
43
464130c45935
Linux support, first cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
2
diff
changeset
|
65 |
|
464130c45935
Linux support, first cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
2
diff
changeset
|
66 |
public static boolean isLinux() { |
464130c45935
Linux support, first cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
2
diff
changeset
|
67 |
return "linux".equals(Platform.getOS()); |
464130c45935
Linux support, first cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
2
diff
changeset
|
68 |
} |
2 | 69 |
} |