]> gitweb.fperrin.net Git - GpsPrune.git/blob - tim/prune/ExternalTools.java
Version 7, February 2009
[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 gnuplot to see if it's installed / available in path
42          * @return true if found, false otherwise
43          */
44         public static boolean isGnuplotInstalled()
45         {
46                 return check(Config.getGnuplotPath() + " -V");
47         }
48
49         /**
50          * Attempt to call the specified command
51          * @return true if found, false otherwise
52          */
53         private static boolean check(String inCommand)
54         {
55                 try
56                 {
57                         Runtime.getRuntime().exec(inCommand);
58                         return true;
59                 }
60                 catch (IOException ioe)
61                 {
62                         // exception thrown, command not found
63                         return false;
64                 }
65         }
66 }