ccs.utils
Class ExeName

java.lang.Object
  extended by ccs.utils.ExeName

public class ExeName
extends java.lang.Object

Executables have different names on different platforms. E.g. "jstart" on linux will be "jstart.exe" on win32. We might in future institute some kind of convention to decorate executable names to distinguish the various flavours of unix / linux / solaris / etc. Use this class to translate.


Constructor Summary
ExeName()
           
 
Method Summary
static boolean isPossiblyExecutable(java.io.File f)
          whether the supplied file might be a valid executable; it doesn't check.
static java.lang.String translate(java.io.File dir, java.lang.String name)
          translate an "abstract name" for an executable into suitable form for Runtime.exec.
static java.io.File translateFile(java.io.File dir, java.lang.String name)
          translate an "abstract name" for an executable into suitable form for Runtime.exec.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ExeName

public ExeName()
Method Detail

translateFile

public static java.io.File translateFile(java.io.File dir,
                                         java.lang.String name)
translate an "abstract name" for an executable into suitable form for Runtime.exec.

Parameters:
dir - The directory containing the executable, e.g. (rootdir)/bin for CP apps.
name - The "abstract name" for the executable. Generally the name without any extensions, platform-identifying decorations etc.
Returns:
The File representing the executable.

translate

public static java.lang.String translate(java.io.File dir,
                                         java.lang.String name)
translate an "abstract name" for an executable into suitable form for Runtime.exec.

Parameters:
dir - The directory containing the executable, e.g. (rootdir)/bin for CP apps.
name - The "abstract name" for the executable. Generally the name without any extensions, platform-identifying decorations etc.
Returns:
The full path to the executable, suitable to be fed straight to Runtime.exec.

isPossiblyExecutable

public static boolean isPossiblyExecutable(java.io.File f)
whether the supplied file might be a valid executable; it doesn't check.