Changeset 10363


Ignore:
Timestamp:
2005-08-01T11:15:12+12:00 (19 years ago)
Author:
mdewsnip
Message:

Moved some applet specific code out of Gatherer.java and into GathererApplet.java.

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

Legend:

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

    r10362 r10363  
    149149        Configuration.GS3_CONFIG_XML = "config3Remote.xml";
    150150
    151         File col_dir = new File(Gatherer.getCollectDirectoryPath());
    152         if (!col_dir.exists()) {
    153         if (JarTools.isInJar(Utility.COLLECT_ZIP)) {
    154             // Dig out collect.zip from JAR file and unzip it (thereby
    155             // creating collect directory and descendants.
    156             //   This is done to seed gsdl home folder with config files
    157             //   for documented example collections so "base this on
    158             //   existing collection" works
    159             ZipTools.unzipFromJar(Utility.COLLECT_ZIP, getGLIUserDirectoryPath());
    160         }
    161         else {
    162             // Prepare an empty collect dir for general use
    163             if (!col_dir.mkdir()) {
    164             System.err.println("Warning: Unable to make directory: " + col_dir.toString());
    165             }
    166         }
    167         }
    168 
    169         File metadata_directory = new File(Gatherer.getGLIMetadataDirectoryPath());
    170         if (!metadata_directory.exists()) {
    171         // dig out metadata.zip from JAR file and unzip it
    172         ZipTools.unzipFromJar(Utility.METADATA_ZIP, getGLIUserDirectoryPath());
    173         }
    174 
    175         File plug_dat = new File(getGLIUserDirectoryPath() + "plugins.dat");
    176         if (!plug_dat.exists()) {
     151        File collect_directory = new File(Gatherer.getCollectDirectoryPath());
     152        if (!collect_directory.exists() && !collect_directory.mkdir()) {
     153        System.err.println("Warning: Unable to make directory: " + collect_directory);
     154        }
     155
     156        File plugins_dat_file = new File(getGLIUserDirectoryPath() + "plugins.dat");
     157        if (!plugins_dat_file.exists()) {
    177158        JarTools.extractFromJar("plugins.dat", getGLIUserDirectoryPath(), false);
    178159        }
    179160
    180         File class_dat = new File(getGLIUserDirectoryPath() + "classifiers.dat");
    181         if (!class_dat.exists()) {
     161        File classifiers_dat_file = new File(getGLIUserDirectoryPath() + "classifiers.dat");
     162        if (!classifiers_dat_file.exists()) {
    182163        JarTools.extractFromJar("classifiers.dat", getGLIUserDirectoryPath(), false);
    183164        }
  • trunk/gli/src/org/greenstone/gatherer/GathererApplet.java

    r10362 r10363  
    3636import java.io.*;
    3737import javax.swing.*;
     38import org.greenstone.gatherer.util.JarTools;
    3839import org.greenstone.gatherer.util.Utility;
     40import org.greenstone.gatherer.util.ZipTools;
    3941
    4042
     
    129131                    };
    130132
     133    File collect_directory = new File(Gatherer.getCollectDirectoryPath());
     134    if (!collect_directory.exists()) {
     135        if (JarTools.isInJar("collect.zip")) {
     136        // Dig out collect.zip from JAR file and unzip it (thereby
     137        // creating collect directory and descendants.
     138        //   This is done to seed gsdl home folder with config files
     139        //   for documented example collections so "base this on
     140        //   existing collection" works
     141        ZipTools.unzipFromJar("collect.zip", Gatherer.getGLIUserDirectoryPath());
     142        }
     143        else {
     144        // Prepare an empty collect dir for use
     145        if (!collect_directory.mkdir()) {
     146            System.err.println("Warning: Unable to make directory: " + collect_directory);
     147        }
     148        }
     149    }
     150
     151    File metadata_directory = new File(Gatherer.getGLIMetadataDirectoryPath());
     152    if (!metadata_directory.exists()) {
     153        // dig out metadata.zip from JAR file and unzip it
     154        ZipTools.unzipFromJar("metadata.zip", Gatherer.getGLIDirectoryPath());
     155    }
     156
    131157    // Create an instance of the Gatherer class, which will parse the args and prepare the rest of the GLI
    132158    gatherer = new Gatherer(args);
  • trunk/gli/src/org/greenstone/gatherer/util/Utility.java

    r10345 r10363  
    8787    /** Definition of an important directory name, in this case the location of the expected collection metadata sets.. */
    8888    static final public String META_DIR = "metadata" + File.separator; // Col. Copy
    89     /** Definition of an important zip file, in this case zipped up version of metadata file stored in JAR file */
    90     static final public String METADATA_ZIP = "metadata.zip";
    91     static final public String COLLECT_ZIP = "collect.zip";
    9289    /** The default name of the perl executable under unix. */
    9390    static final public String PERL_EXECUTABLE_UNIX = "perl";
Note: See TracChangeset for help on using the changeset viewer.