Changeset 9217


Ignore:
Timestamp:
2005-03-01T10:39:23+13:00 (19 years ago)
Author:
mdewsnip
Message:

Fixed up a few problems with setting the wget path manually from the gli.sh file, and getting the default Greenstone wget path on the Mac.

Location:
trunk/gli/src/org/greenstone/gatherer
Files:
5 edited

Legend:

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

    r9093 r9217  
    124124               String library_url_string, boolean debug_enabled, String perl_path,
    125125               boolean no_load, String open_collection,
    126                String site_name, String servlet_path,
    127                String wget_version_str, String wget_path)
     126               String site_name, String servlet_path, String wget_path)
    128127    {
    129128    if (gsdl3_path != null && !gsdl3_path.equals("")) {
     
    247246        }
    248247
    249         // also check for wget
    250248        boolean download_workflow = Configuration.get("workflow.download", false);
    251249        if (download_workflow) {
    252         wget_version_str = StaticStrings.NO_WGET_STR;
    253         // has the user specified a path?
    254         if (wget_path != null && !wget_path.equals("")) {
    255             File wget_file = new File(wget_path);
     250        // If the WGet path hasn't been specified by the user, try the Greenstone one
     251        if (wget_path == null) {
     252            File wget_file = new File(Utility.getWGetPath(gsdl_path));
    256253            if (wget_file.exists()) {
    257             // we assume its ok if its there
    258             wget_version_str = StaticStrings.WGET_STR;
    259             }
    260         }
    261        
    262         // it hasn't been set by the user so we use the greenstone one
    263         if (wget_version_str.equals(StaticStrings.NO_WGET_STR)) {
    264             // TODO fix for gs3
    265             wget_path = Utility.getWGetPath(gsdl_path);
    266             File wget_file = new File(wget_path);
    267             if (!wget_file.exists()) {
    268             // we give up trying to find one
    269             missingWGET();
    270             } else {
    271             // we have found one
    272             wget_version_str = StaticStrings.WGET_STR;
     254            wget_path = Utility.getWGetPath(gsdl_path);
    273255            }
    274         }
    275        
    276         if (wget_version_str.equals(StaticStrings.WGET_STR)) {
    277             // we have found one, should we check the version??
     256        }
     257
     258        // If we still don't have a WGet path, give up (there isn't anything else we can do)
     259        String wget_version_str = null;
     260        if (wget_path == null) {
     261            wget_version_str = StaticStrings.NO_WGET_STR;
     262            missingWGET();
     263        }
     264        // Otherwise check the version of WGet
     265        else {
    278266            wget_version_str = testWGetVersion(wget_path);
    279267            if (wget_version_str.equals(StaticStrings.WGET_OLD_STR)) {
     
    281269            }
    282270        }
    283        
    284         // tell the config the new values
     271
     272        // Store the new values in the configuration
     273        DebugStream.println("WGet path: " + wget_path);
    285274        Configuration.setWGetPath(wget_path);
    286275        Configuration.setWGetVersion(wget_version_str);
     
    591580    dialog.dispose();
    592581    dialog = null;
    593    }
     582    }
    594583
    595584    /** 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. */
  • trunk/gli/src/org/greenstone/gatherer/GathererApplet.java

    r9202 r9217  
    169169                    go.library_url_string, go.debug, go.perl_path,
    170170                    go.no_load, go.filename, go.site_name,
    171                     go.servlet_path, go.wget_version_str, go.wget_path);
     171                    go.servlet_path, go.wget_path);
    172172
    173173    JButton bttn = new JButton("Launch Greenstone Librarian Interface ...");
  • trunk/gli/src/org/greenstone/gatherer/GathererProg.java

    r9092 r9217  
    103103                 go.library_url_string, go.debug, go.perl_path,
    104104                 go.no_load, go.filename, go.site_name,
    105                  go.servlet_path, go.wget_version_str, go.wget_path);
     105                 go.servlet_path, go.wget_path);
    106106    gatherer.run(size, g_man);
    107107
  • trunk/gli/src/org/greenstone/gatherer/GetOpt.java

    r9055 r9217  
    4949    public String servlet_path = null;
    5050    public String wget_path = null;
    51     public String wget_version_str = StaticStrings.NO_WGET_STR;
     51
    5252
    5353    public GetOpt(String[] args)
     
    193193            library_url_string = argument_value;
    194194            }
    195             // Parse the path to PERL. If not provided its assumes
     195            // Parse the path to PERL. If not provided it assumes
    196196            // perl should be availble on the PATH.
    197197            else if(argument_name.equals(StaticStrings.PERL_ARGUMENT)) {
     
    213213                perl_file = null;
    214214            }
    215             // Otherwise its fine as it is
    216             }
    217             // Test for the presence of a WGet version. This is
    218             // only useful if the user has enabled mirroring. Note
    219             // that mirroring can be enabled by running the GLI
    220             // with -mirror, editing the config.xml for GLI, or
    221             // through a new option on the connections page of the
    222             // preferences.
    223             else if(argument_name.equals(StaticStrings.WGET_ARGUMENT)) {
    224             if(argument_value.startsWith(StaticStrings.WGET_STR)) {
    225                 wget_version_str = StaticStrings.WGET_STR;
    226                 wget_path = argument_value.substring(StaticStrings.WGET_STR.length());
    227             }
    228             else if(argument_value.startsWith(StaticStrings.WGET_OLD_STR)) {
    229                 wget_version_str = StaticStrings.WGET_OLD_STR;
    230                 wget_path = argument_value.substring(StaticStrings.WGET_OLD_STR.length());
     215            // Otherwise it is fine as it is
     216            }
     217            // Parse the path to WGet
     218            else if (argument_name.equals(StaticStrings.WGET_ARGUMENT)) {
     219            // Check the specified WGet file exists
     220            if (argument_value != null && !argument_value.equals("")) {
     221                File wget_file = new File(argument_value);
     222                if (wget_file.exists()) {
     223                wget_path = argument_value;
     224                }
    231225            }
    232226            }
  • trunk/gli/src/org/greenstone/gatherer/util/Utility.java

    r9209 r9217  
    900900
    901901    /** returns the path to the greenstone version of wget */
    902     static public String getWGetPath(String gsdl_path) {
     902    static public String getWGetPath(String gsdl_path)
     903    {
    903904    if (isWindows()) {
    904         return gsdl_path + "bin" + File.separator +
    905         "windows" + File.separator +"wget.exe";
    906     }
    907     // is it the same for macs??
    908     return gsdl_path + "bin" + File.separator +
    909         "linux" + File.separator + "wget";
     905        return gsdl_path + "bin" + File.separator + "windows" + File.separator + "wget.exe";
     906    }
     907    else if (isMac()) {
     908        return gsdl_path + "bin" + File.separator + "darwin" + File.separator + "wget";
     909    }
     910    else {
     911        return gsdl_path + "bin" + File.separator + "linux" + File.separator + "wget";
     912    }
    910913    }
    911914
Note: See TracChangeset for help on using the changeset viewer.