author | Eugene Ostroukhov <eugeneo@symbian.org> |
Mon, 23 Aug 2010 10:30:05 -0700 | |
changeset 472 | bd9f2d7c64a6 |
parent 471 | 06589bf52fa7 |
child 484 | f5df819c1852 |
permissions | -rw-r--r-- |
471
06589bf52fa7
Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
1 |
/******************************************************************************* |
06589bf52fa7
Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
2 |
* Copyright (c) 2009 Symbian Foundation and/or its subsidiary(-ies). |
06589bf52fa7
Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
3 |
* All rights reserved. |
06589bf52fa7
Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
4 |
* This component and the accompanying materials are made available |
06589bf52fa7
Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
5 |
* under the terms of the License "Eclipse Public License v1.0" |
06589bf52fa7
Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
6 |
* which accompanies this distribution, and is available |
06589bf52fa7
Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html". |
06589bf52fa7
Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
8 |
* |
06589bf52fa7
Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
9 |
* Initial Contributors: |
06589bf52fa7
Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
10 |
* Symbian Foundation - initial contribution. |
06589bf52fa7
Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
11 |
* Contributors: |
06589bf52fa7
Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
12 |
* Description: |
06589bf52fa7
Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
13 |
* Overview: |
06589bf52fa7
Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
14 |
* Details: |
06589bf52fa7
Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
15 |
* Platforms/Drives/Compatibility: |
06589bf52fa7
Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
16 |
* Assumptions/Requirement/Pre-requisites: |
06589bf52fa7
Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
17 |
* Failures and causes: |
06589bf52fa7
Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
18 |
*******************************************************************************/ |
06589bf52fa7
Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
19 |
package org.symbian.tools.tmw.debug.internal; |
06589bf52fa7
Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
20 |
|
06589bf52fa7
Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
21 |
import java.io.File; |
06589bf52fa7
Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
22 |
|
472
bd9f2d7c64a6
Debugger is now Symbian-independant
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
471
diff
changeset
|
23 |
import org.symbian.tools.tmw.core.utilities.CoreUtil; |
471
06589bf52fa7
Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
24 |
|
06589bf52fa7
Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
25 |
public final class ChromeDebugUtils { |
06589bf52fa7
Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
26 |
public static String getExecutablePath(String folder) { |
06589bf52fa7
Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
27 |
File file = new File(folder); |
06589bf52fa7
Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
28 |
if (file.isDirectory()) { |
06589bf52fa7
Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
29 |
File chromeExecutable = new File(file, getExecutable()); |
06589bf52fa7
Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
30 |
if (chromeExecutable.isFile()) { |
06589bf52fa7
Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
31 |
return chromeExecutable.getAbsolutePath(); |
06589bf52fa7
Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
32 |
} else if (CoreUtil.isMac() && file.getName().equals("Google Chrome.app")) { |
06589bf52fa7
Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
33 |
return getExecutablePath(file.getParent()); |
06589bf52fa7
Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
34 |
} |
06589bf52fa7
Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
35 |
} else if (file.isFile()) { |
06589bf52fa7
Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
36 |
if (file.getName().equalsIgnoreCase(getExecutable())) { |
06589bf52fa7
Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
37 |
return file.getAbsolutePath(); |
06589bf52fa7
Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
38 |
} |
06589bf52fa7
Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
39 |
} |
06589bf52fa7
Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
40 |
return null; |
06589bf52fa7
Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
41 |
} |
06589bf52fa7
Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
42 |
|
06589bf52fa7
Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
43 |
private static String getExecutable() { |
06589bf52fa7
Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
44 |
// Add more ifs as we add support for new platforms |
06589bf52fa7
Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
45 |
if (CoreUtil.isMac()) { |
06589bf52fa7
Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
46 |
return "Google Chrome.app/Contents/MacOS/Google Chrome"; |
06589bf52fa7
Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
47 |
} else if (CoreUtil.isLinux()) { |
06589bf52fa7
Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
48 |
return "chrome"; |
06589bf52fa7
Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
49 |
} else { |
06589bf52fa7
Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
50 |
return "chrome.exe"; |
06589bf52fa7
Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
51 |
} |
06589bf52fa7
Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
52 |
} |
06589bf52fa7
Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
53 |
|
06589bf52fa7
Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
54 |
private ChromeDebugUtils() { |
06589bf52fa7
Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
55 |
// No instantiating |
06589bf52fa7
Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
56 |
} |
06589bf52fa7
Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
57 |
|
06589bf52fa7
Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
58 |
public static String getChromeExecutible() { |
06589bf52fa7
Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
59 |
return getExecutablePath(Activator.getDefault().getPreferenceStore().getString(IConstants.PREF_NAME_CHROME_LOCATION)); |
06589bf52fa7
Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
60 |
} |
06589bf52fa7
Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
61 |
|
06589bf52fa7
Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
62 |
} |