Changeset 6593


Ignore:
Timestamp:
2004-01-23T09:40:26+13:00 (20 years ago)
Author:
jmt12
Message:

Have finalised the code for user specific settings under windows. I've tested on WinXP and Win98 with multiple users, and Win98 with a single user. Under single user the user.home is C:\Windows. Apparently its pretty common to just create an Application Data folder and put settings there, with or without multiple users. I'm not sure if thats true for WinXP, but I can't really tes that.

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

Legend:

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

    r6589 r6593  
    178178
    179179    // Try to reload the configuration. The first place we look is the user specific location
    180     File user_config_xml = null;
    181     // Windows. What to do, what to do?
    182     if(Utility.isWindows()) {
    183        
    184     }
    185     // Unix based systems. This one I know. Look for .gli/config.xml in the users home folder
    186     else {
    187         user_config_xml = new File(Utility.getGLIUserFolder(), CONFIG_XML);     
    188     }
     180    File user_config_xml = new File(Utility.getGLIUserFolder(), CONFIG_XML);       
    189181    if(user_config_xml != null && user_config_xml.exists()) {
    190182        general_config = Utility.parse(user_config_xml.getAbsolutePath(), false);
     
    618610    File user_config_xml = null;
    619611    try {
    620         if(Utility.isWindows()) {
    621        
    622         }
    623         // Unix systems save user preferences in . folders in the home directory.
    624         else {
    625         user_config_xml = new File(Utility.getGLIUserFolder(), CONFIG_XML);
    626         ///ystem.err.println("Trying to save to: " + user_config_xml.getAbsolutePath());
    627         ///ystem.err.println("Writing.");
    628         user_config_xml.getParentFile().mkdirs();
    629         Utility.export(general_config, user_config_xml.getAbsolutePath());
    630         }
     612        user_config_xml = new File(Utility.getGLIUserFolder(), CONFIG_XML);
     613        ///ystem.err.println("Trying to save to: " + user_config_xml.getAbsolutePath());
     614        ///ystem.err.println("Writing.");
     615        user_config_xml.getParentFile().mkdirs();
     616        Utility.export(general_config, user_config_xml.getAbsolutePath());
    631617    }
    632618    catch(Exception exception) {
  • trunk/gli/src/org/greenstone/gatherer/util/Utility.java

    r6581 r6593  
    554554    }
    555555
     556    static final private String APPLICATION_DATA_FOLDER = "Application Data";
     557    static final private String UNIX_GLI_CONFIG_FOLDER = ".gli";
     558    static final private String USER_HOME_PROPERTY = "user.home";
     559    static final private String WIN_GLI_CONFIG_FOLDER = "Greenstone" + File.separator + "GLI";
     560
    556561    static public File getGLIUserFolder() {
    557     File gli_user_folder = new File(System.getProperty("user.home") + File.separator + ".gli" + File.separator);
     562    File gli_user_folder = null;
     563    if(Utility.isWindows()) {
     564        gli_user_folder = new File(System.getProperty(USER_HOME_PROPERTY) + File.separator + APPLICATION_DATA_FOLDER + File.separator + GLI_CONFIG_FOLDER + File.separator);
     565    }
     566    else {
     567        gli_user_folder = new File(System.getProperty(USER_HOME_PROPERTY) + File.separator + GLI_CONFIG_FOLDER + File.separator);
     568    }
    558569    return gli_user_folder;
    559570    }
Note: See TracChangeset for help on using the changeset viewer.