plugins/org.symbian.tools.tmw.debug/src/org/symbian/tools/tmw/debug/internal/ChromeDebugUtils.java
changeset 484 f5df819c1852
parent 472 bd9f2d7c64a6
equal deleted inserted replaced
483:109da596fa9d 484:f5df819c1852
    21 import java.io.File;
    21 import java.io.File;
    22 
    22 
    23 import org.symbian.tools.tmw.core.utilities.CoreUtil;
    23 import org.symbian.tools.tmw.core.utilities.CoreUtil;
    24 
    24 
    25 public final class ChromeDebugUtils {
    25 public final class ChromeDebugUtils {
    26 	public static String getExecutablePath(String folder) {
    26     public static String getExecutablePath(String folder) {
    27 		File file = new File(folder);
    27         File file = new File(folder);
    28 		if (file.isDirectory()) {
    28         if (file.isDirectory()) {
    29 			File chromeExecutable = new File(file, getExecutable());
    29             File chromeExecutable = new File(file, getExecutable());
    30 			if (chromeExecutable.isFile()) {
    30             if (chromeExecutable.isFile()) {
    31 				return chromeExecutable.getAbsolutePath();
    31                 return chromeExecutable.getAbsolutePath();
    32             } else if (CoreUtil.isMac() && file.getName().equals("Google Chrome.app")) {
    32             } else if (CoreUtil.isMac() && file.getName().equals("Google Chrome.app")) {
    33                 return getExecutablePath(file.getParent());
    33                 return getExecutablePath(file.getParent());
    34 			}
    34             }
    35         } else if (file.isFile()) {
    35         } else if (file.isFile()) {
    36             if (file.getName().equalsIgnoreCase(getExecutable())) {
    36             if (file.getName().equalsIgnoreCase(getExecutable())) {
    37                 return file.getAbsolutePath();
    37                 return file.getAbsolutePath();
    38             }
    38             }
    39 		}
    39         }
    40 		return null;
    40         return null;
    41 	}
    41     }
    42 
    42 
    43 	private static String getExecutable() {
    43     private static String getExecutable() {
    44 		// Add more ifs as we add support for new platforms
    44         // Add more ifs as we add support for new platforms
    45 		if (CoreUtil.isMac()) {
    45         if (CoreUtil.isMac()) {
    46 			return "Google Chrome.app/Contents/MacOS/Google Chrome";
    46             return "Google Chrome.app/Contents/MacOS/Google Chrome";
    47 		} else if (CoreUtil.isLinux()) {
    47         } else if (CoreUtil.isLinux()) {
    48 			return "chrome";
    48             return "chrome";
    49 		} else {
    49         } else {
    50 			return "chrome.exe";
    50             return "chrome.exe";
    51 		}
    51         }
    52 	}
    52     }
    53 	
       
    54 	private ChromeDebugUtils() {
       
    55 		// No instantiating
       
    56 	}
       
    57 
    53 
    58 	public static String getChromeExecutible() {
    54     private ChromeDebugUtils() {
    59 		return getExecutablePath(Activator.getDefault().getPreferenceStore().getString(IConstants.PREF_NAME_CHROME_LOCATION));
    55         // No instantiating
    60 	}
    56     }
       
    57 
       
    58     public static String getChromeExecutible() {
       
    59         return getExecutablePath(Activator.getDefault().getPreferenceStore()
       
    60                 .getString(IConstants.PREF_NAME_CHROME_LOCATION));
       
    61     }
    61 
    62 
    62 }
    63 }