X-Git-Url: http://gitweb.fperrin.net/?a=blobdiff_plain;f=tim%2Fprune%2FExternalTools.java;h=22291fb122968331a6f1a52b28d4f9fc56782cb7;hb=54b9d8bc8f0025ccf97a67d9dd217ef1f9cf082f;hp=cd65fffd519d68a95a21b0623dac2146d3e0048b;hpb=5625a1abadb5f2ca5f017fe7dbda1d5141cb637b;p=GpsPrune.git diff --git a/tim/prune/ExternalTools.java b/tim/prune/ExternalTools.java index cd65fff..22291fb 100644 --- a/tim/prune/ExternalTools.java +++ b/tim/prune/ExternalTools.java @@ -15,16 +15,7 @@ public abstract class ExternalTools */ public static boolean isPovrayInstalled() { - try - { - Runtime.getRuntime().exec("povray"); - return true; - } - catch (IOException ioe) - { - // exception thrown, povray not found - return false; - } + return check("povray"); } @@ -33,15 +24,42 @@ public abstract class ExternalTools * @return true if found, false otherwise */ public static boolean isExiftoolInstalled() + { + return check("exiftool -v"); + } + + /** + * Attempt to call gpsbabel to see if it's installed / available in path + * @return true if found, false otherwise + */ + public static boolean isGpsbabelInstalled() + { + return check("gpsbabel -V"); + } + + /** + * Attempt to call gnuplot to see if it's installed / available in path + * @return true if found, false otherwise + */ + public static boolean isGnuplotInstalled() + { + return check(Config.getGnuplotPath() + " -V"); + } + + /** + * Attempt to call the specified command + * @return true if found, false otherwise + */ + private static boolean check(String inCommand) { try { - Runtime.getRuntime().exec("exiftool -v"); + Runtime.getRuntime().exec(inCommand); return true; } catch (IOException ioe) { - // exception thrown, exiftool not found + // exception thrown, command not found return false; } }