Changeset 9580


Ignore:
Timestamp:
2005-04-07T13:37:28+12:00 (19 years ago)
Author:
mdewsnip
Message:

Added a check for ImageMagick when the GLI starts up.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/gli/src/org/greenstone/gatherer/Gatherer.java

    r9350 r9580  
    214214        }
    215215
     216        // Check for ImageMagick
     217        if (Gatherer.isGsdlRemote) {
     218        DebugStream.println("Not checking for ImageMagick.");
     219        }
     220        else if (!(new ImageMagickTest()).found()) {
     221        // Time for a warning message
     222        missingImageMagick();
     223        }
     224       
    216225        if (Gatherer.isGsdlRemote) {
    217226        DebugStream.println("Not checking for perl path/exe");
     
    570579
    571580
    572     /** Prints a warning message about a missing GSDL path, which although not fatal pretty much ensures nothing will work properly in the Gatherer.
     581    /** Prints a warning message about a missing GSDL path, which although not fatal pretty much ensures nothing will work properly in the GLI.
    573582     */
    574583    static public void missingGSDL() {
     
    579588    }
    580589
    581     /** Prints a warning message about a missing PERL path, which although not fatal pretty much ensures no collection creation/building will work properly in the Gatherer. */
     590    /** Prints a warning message about missing a valid ImageMagick path, which although not fatal means building image collections won't work */
     591    static public void missingImageMagick() {
     592    WarningDialog dialog = new WarningDialog("warning.MissingImageMagick", "MissingImageMagick.Title", "MissingImageMagick.Message", null, false);
     593    dialog.display();
     594    dialog.dispose();
     595    dialog = null;
     596    }
     597
     598    /** Prints a warning message about missing a valid PERL path, which although not fatal pretty much ensures no collection creation/building will work properly in the GLI. */
    582599    static public void missingPERL() {
    583600    WarningDialog dialog = new WarningDialog("warning.MissingPERL", "MissingPERL.Title", "MissingPERL.Message", null, false);
     
    587604    }
    588605
    589     /** Prints a warning message about a missing a valid WGet path. not fatal, but mirroring won't work */
     606    /** Prints a warning message about missing a valid WGet path, which although not fatal means mirroring won't work */
    590607    static public void missingWGET() {
    591608    WarningDialog dialog = new WarningDialog("warning.MissingWGET", "MissingWGET.Title", "MissingWGET.Message", null, false);
     
    793810
    794811
    795     private class PerlTest {
    796 
     812    private class ImageMagickTest
     813    {
     814    public boolean found()
     815    {
     816        try {
     817        String command = (Utility.isWindows() ? "identify.exe" : "identify");
     818        Process image_magick_process = Runtime.getRuntime().exec(command);
     819        image_magick_process.waitFor();
     820        return (image_magick_process.exitValue() == 0);
     821        }
     822        catch (Exception exception) {
     823        return false;
     824        }
     825    }
     826    }
     827
     828
     829    private class PerlTest
     830    {
    797831    private String[] command = new String[2];
    798832
    799     public PerlTest() {
    800         if(Utility.isWindows()) {
    801         command[0] = Utility.PERL_EXECUTABLE_WINDOWS;
    802         }
    803         else {
    804         command[0] = Utility.PERL_EXECUTABLE_UNIX;
    805         }
     833    public PerlTest()
     834    {
     835        command[0] = (Utility.isWindows() ? Utility.PERL_EXECUTABLE_WINDOWS : Utility.PERL_EXECUTABLE_UNIX);
    806836        command[1] = "-version";
    807837    }
    808838
    809     public boolean found() {
    810         boolean found = false;
     839    public boolean found()
     840    {
    811841        try {
    812         Process prcs = Runtime.getRuntime().exec(command);
    813         prcs.waitFor();
    814         found = (prcs.exitValue() == 0);
    815         prcs = null;
    816         }
    817         catch(Exception error) {
    818         }
    819         return found;
     842        Process perl_process = Runtime.getRuntime().exec(command);
     843        perl_process.waitFor();
     844        return (perl_process.exitValue() == 0);
     845        }
     846        catch (Exception exception) {
     847        return false;
     848        }
    820849    }
    821850
Note: See TracChangeset for help on using the changeset viewer.