org.af.jhlir.tools
Class DirectoryGuesser

java.lang.Object
  extended by org.af.jhlir.tools.DirectoryGuesser

public class DirectoryGuesser
extends Object

Class encapsulates methods to guess installation paths for used third party applications and our own applications


Nested Class Summary
static class DirectoryGuesser.ContainsFilePredicate
           
static class DirectoryGuesser.Predicate
           
static class DirectoryGuesser.RHomeBinPredicate
           
 
Constructor Summary
DirectoryGuesser()
           
 
Method Summary
static String guessDesktop()
           
static String guessJavaHome()
           
static String guessPDFViewerPath()
          Guesses absolute path to PDF viewer.
static String guessRHome()
          Guesses R Home.
static String searchDir(String[] search, String[] searchDir, String[] searchFile, boolean directory)
          Searches for files and returns the first candidate.
static File searchForFile(File dir, List<String> searchFirst, DirectoryGuesser.Predicate pred)
           
static String searchforFile(File dir, String[] searchDir, String[] searchFile, boolean directory)
          Searches for files and returns the first candidate.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DirectoryGuesser

public DirectoryGuesser()
Method Detail

searchDir

public static String searchDir(String[] search,
                               String[] searchDir,
                               String[] searchFile,
                               boolean directory)
Searches for files and returns the first candidate.

Parameters:
search - Array of paths to the root directories of this search.
searchDir - Files which contain these Strings as substrings should be searched.
searchFile - Files which contain these Strings as substrings are final candidates.
directory - is the file we are looking for a directory?
Returns:

searchforFile

public static String searchforFile(File dir,
                                   String[] searchDir,
                                   String[] searchFile,
                                   boolean directory)
Searches for files and returns the first candidate.

Parameters:
searchDir - Files which contain these Strings as substrings should be searched.
searchFile - Files which contain these Strings as substrings are final candidates.
directory - is the file we are looking for a directory?
Returns:

searchForFile

public static File searchForFile(File dir,
                                 List<String> searchFirst,
                                 DirectoryGuesser.Predicate pred)

guessPDFViewerPath

public static String guessPDFViewerPath()
Guesses absolute path to PDF viewer.

Returns:
Guessed path to PDF viewer.

guessRHome

public static String guessRHome()
Guesses R Home.

Returns:
Guessed path to R Home.

guessJavaHome

public static String guessJavaHome()

guessDesktop

public static String guessDesktop()