]> gitweb.fperrin.net Git - GpsPrune.git/blobdiff - tim/prune/ExternalTools.java
Version 5, May 2008
[GpsPrune.git] / tim / prune / ExternalTools.java
index cd65fffd519d68a95a21b0623dac2146d3e0048b..36c496a6e24229603769d5ff8405cc397ff645f8 100644 (file)
@@ -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;
                }
        }