Changeset 8650


Ignore:
Timestamp:
2004-11-24T13:30:46+13:00 (19 years ago)
Author:
mdewsnip
Message:

The plugins.dat and classifiers.dat files are now stored in the GLI user directory, as part of making the GLI work nicely with one installation and multiple people using it.

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

Legend:

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

    r8360 r8650  
    103103
    104104    DebugStream.println("deleting classifiers.dat");
    105     File class_file = new File(Utility.BASE_DIR + "classifiers.dat");
     105    File class_file = new File(Utility.getGLIUserFolder() + "classifiers.dat");
    106106    if (class_file.exists()) {
    107107        return Utility.delete(class_file);
     
    260260    private void saveClassifiers() {
    261261    try {
    262         FileOutputStream file = new FileOutputStream(Utility.BASE_DIR + "classifiers.dat");
     262        FileOutputStream file = new FileOutputStream(Utility.getGLIUserFolder() + "classifiers.dat");
    263263        ObjectOutputStream out = new ObjectOutputStream(file);
    264264        out.writeObject(library);
     
    368368    // Attempt to restore the cached file.
    369369    try {
    370         FileInputStream file = new FileInputStream(Utility.BASE_DIR + "classifiers.dat");
     370        FileInputStream file = new FileInputStream(Utility.getGLIUserFolder() + "classifiers.dat");
    371371        ObjectInputStream input = new ObjectInputStream(file);
    372372        library = (ArrayList) input.readObject();
    373373    }
    374374    catch (Exception error) {
    375         DebugStream.println("Unable to open "+ Utility.BASE_DIR + "classifier.dat");
     375        DebugStream.println("Unable to open "+ Utility.getGLIUserFolder() + "classifier.dat");
    376376    }
    377377
  • trunk/gli/src/org/greenstone/gatherer/cdm/PluginManager.java

    r8607 r8650  
    105105
    106106    DebugStream.println("deleting plugins.dat");
    107     File plugin_file = new File(Utility.BASE_DIR + "plugins.dat");
     107    File plugin_file = new File(Utility.getGLIUserFolder() + "plugins.dat");
    108108    if (plugin_file.exists()) {
    109109        return Utility.delete(plugin_file);
     
    332332    private void savePlugins() {
    333333    try {
    334         FileOutputStream file = new FileOutputStream(Utility.BASE_DIR + "plugins.dat");
     334        FileOutputStream file = new FileOutputStream(Utility.getGLIUserFolder() + "plugins.dat");
    335335        ObjectOutputStream out = new ObjectOutputStream(file);
    336336        out.writeObject(library);
     
    472472    // Attempt to restore the cached file.
    473473    try {
    474         FileInputStream file = new FileInputStream(Utility.BASE_DIR + "plugins.dat");
     474        FileInputStream file = new FileInputStream(Utility.getGLIUserFolder() + "plugins.dat");
    475475        ObjectInputStream input = new ObjectInputStream(file);
    476476        library = (ArrayList) input.readObject();
    477477    }
    478478    catch (Exception error) {
    479         DebugStream.println("Unable to open "+ Utility.BASE_DIR + "plugins.dat");
     479        DebugStream.println("Unable to open "+ Utility.getGLIUserFolder() + "plugins.dat");
    480480    }
    481481
  • trunk/gli/src/org/greenstone/gatherer/util/Utility.java

    r8622 r8650  
    524524    }
    525525
     526
    526527    static final private String APPLICATION_DATA_FOLDER = "Application Data";
    527528    static final private String UNIX_GLI_CONFIG_FOLDER = ".gli";
     
    529530    static final private String WIN_GLI_CONFIG_FOLDER = "Greenstone" + File.separator + "GLI";
    530531
    531     static public File getGLIUserFolder() {
    532     File gli_user_folder = null;
    533     if(Utility.isWindows()) {
    534         gli_user_folder = new File(System.getProperty(USER_HOME_PROPERTY) + File.separator + APPLICATION_DATA_FOLDER + File.separator + WIN_GLI_CONFIG_FOLDER + File.separator);
     532    static public File getGLIUserFolder()
     533    {
     534    if (Utility.isWindows()) {
     535        return new File(System.getProperty(USER_HOME_PROPERTY) + File.separator + APPLICATION_DATA_FOLDER + File.separator + WIN_GLI_CONFIG_FOLDER + File.separator);
    535536    }
    536537    else {
    537         gli_user_folder = new File(System.getProperty(USER_HOME_PROPERTY) + File.separator + UNIX_GLI_CONFIG_FOLDER + File.separator);
    538     }
    539     return gli_user_folder;
    540     }
     538        return new File(System.getProperty(USER_HOME_PROPERTY) + File.separator + UNIX_GLI_CONFIG_FOLDER + File.separator);
     539    }
     540    }
     541
    541542
    542543    /** Retrieve the full file path to the help index xml file.
Note: See TracChangeset for help on using the changeset viewer.