package com.opera.core.systems;

import java.io.File;

import org.openqa.selenium.Platform;

/**
 * @author stuartk
 */
public class OperaPaths {

  public String operaPath() {
    String path;
    if ((path = System.getenv("OPERA_PATH")) != null) return path;
    
    if (Platform.getCurrent().is(Platform.LINUX)) {
      // TODO run which to see if we can get the Opera location
      
      // Check the default location
      path = "/usr/bin/opera";     
    }
    else if (Platform.getCurrent().is(Platform.WINDOWS)) {
      String progfiles = System.getenv("PROGRAMFILES");
      if (progfiles == null) progfiles = "\\Program Files";
      
      path = progfiles + "\\Opera\\opera.exe";  
    }
    
    if (new File(path).exists()) return path;    
    return null;
  }

  public String launcherPath() {
    return "/home/stuart/bin/opera-launcher";
  }

}

@@ -140,16 +140,447 @@
 aths %7B%0A%0A
+  /**%0A   * This method will try and find Opera on any system. It takes the following%0A   * steps:%0A   *  1. Check the environment variable %22OPERA_PATH%22. If it exists, and the%0A   *     file it points to exists, then return%0A   *  2. (Unix) Call %60which%C2%A0opera%60 to find the location%0A   *  3. Check if Opera exists at the default location on the respective OS%0A   *  4. Give up and return null%0A   * @return The path to Opera, or null%0A   */%0A
   public
@@ -1211,83 +1211,544 @@
 %0A%0A  
-public String launcherPath() %7B%0A    return %22/home/stuart/bin/opera-launcher%22
+/**%0A   * This method will try and find Opera Launcher on any system.%0A   * @return The path to Opera Launcher, or null%0A   */%0A  public String launcherPath() %7B%0A    return %22/home/stuart/bin/opera-launcher%22;%0A  %7D%0A%0A  /**%0A   * Check that the given path is not null, and exists.%0A   * @param path The path to check.%0A   * @return null if the path is null, or does not exist. Otherwise it returns%0A   * the given path.%0A   */%0A  private String checkPath(String path) %7B%0A    if (path != null && new File(path).exists()) return path;%0A    else return null
 ;%0A  

Add javadoc