Ignore:
Timestamp:
2005-06-03T14:49:55+12:00 (19 years ago)
Author:
mdewsnip
Message:

Moved Utility.getHelpFolder into HelpFrame, as part of tidying up the Utility class.

File:
1 edited

Legend:

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

    r10006 r10009  
    4444import javax.swing.event.*;
    4545import javax.swing.tree.*;
     46import org.greenstone.gatherer.Configuration;
    4647import org.greenstone.gatherer.DebugStream;
    4748import org.greenstone.gatherer.Dictionary;
     
    121122
    122123
     124    /** Retrieve the full file path to the help index xml file.
     125     * @return the full path as a String
     126     */
     127    private String getHelpFolder()
     128    {
     129    String help_folder = "help/" + Configuration.getLanguage() + "/";
     130
     131    // Try in the JAR/classes directory first
     132    URL help_folder_url = Utility.base.getResource("/" + help_folder);  // !!
     133    if (help_folder_url != null) {
     134        return help_folder;
     135    }
     136
     137    // Look in the base directory next
     138    File help_folder_file = new File(help_folder);
     139    if (help_folder_file.exists()) {
     140        return help_folder;
     141    }
     142
     143    // Resort to English
     144    return "help/" + StaticStrings.ENGLISH_LANGUAGE_STR  + "/";
     145    }
     146
     147
    123148    static public void setView(String section_name)
    124149    {
     
    162187        // Load the XML help file and build the contents structure from it
    163188        try {
    164         String help_index = Utility.getHelpFolder() + StaticStrings.HELP_INDEX_FILENAME;
     189        String help_index = getHelpFolder() + StaticStrings.HELP_INDEX_FILENAME;
    165190        Document document = XMLTools.parseXMLFile(help_index, true);
    166191
     
    291316        URL url = null;
    292317
    293         String help_file = Utility.getHelpFolder() + name + StaticStrings.HTM_FILE_EXTENSION;
     318        String help_file = getHelpFolder() + name + StaticStrings.HTM_FILE_EXTENSION;
    294319
    295320        if (name != null && !name.equals(NULL_STRING)) {
Note: See TracChangeset for help on using the changeset viewer.