X-Git-Url: https://gitweb.fperrin.net/?p=GpsPrune.git;a=blobdiff_plain;f=tim%2Fprune%2FExternalTools.java;h=36c496a6e24229603769d5ff8405cc397ff645f8;hp=cd65fffd519d68a95a21b0623dac2146d3e0048b;hb=ca9bdb3916f9c39adbbf95d06ac95c21dafbb4e6;hpb=63f178fd6c6b30b99a01f2a2d700963ea2dfef8b diff --git a/tim/prune/ExternalTools.java b/tim/prune/ExternalTools.java index cd65fff..36c496a 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,33 @@ 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 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; } }