]> gitweb.fperrin.net Git - GpsPrune.git/blob - tim/prune/ExternalTools.java
Version 5, May 2008
[GpsPrune.git] / tim / prune / ExternalTools.java
1 package tim.prune;
2
3 import java.io.IOException;
4
5
6 /**
7  * Class to manage interfaces to external tools, like exiftool
8  */
9 public abstract class ExternalTools
10 {
11
12         /**
13          * Attempt to call Povray to see if it's installed / available in path
14          * @return true if found, false otherwise
15          */
16         public static boolean isPovrayInstalled()
17         {
18                 return check("povray");
19         }
20
21
22         /**
23          * Attempt to call Exiftool to see if it's installed / available in path
24          * @return true if found, false otherwise
25          */
26         public static boolean isExiftoolInstalled()
27         {
28                 return check("exiftool -v");
29         }
30
31         /**
32          * Attempt to call gpsbabel to see if it's installed / available in path
33          * @return true if found, false otherwise
34          */
35         public static boolean isGpsbabelInstalled()
36         {
37                 return check("gpsbabel -V");
38         }
39
40         /**
41          * Attempt to call the specified command
42          * @return true if found, false otherwise
43          */
44         private static boolean check(String inCommand)
45         {
46                 try
47                 {
48                         Runtime.getRuntime().exec(inCommand);
49                         return true;
50                 }
51                 catch (IOException ioe)
52                 {
53                         // exception thrown, command not found
54                         return false;
55                 }
56         }
57 }