Changeset 9876


Ignore:
Timestamp:
2005-05-16T11:28:47+12:00 (19 years ago)
Author:
davidb
Message:

Additional functionality added to GLIUserFolder. Under Windows, but default
the User's home is within "Documents and Settings/..." (usually on C: drive).
In a networked lab this means a user accessing GLI applet on a different
day on a different machine won't have the collections they built previously.
New functionality makes it possible to override where on the filesystem,
the GLIUserFolder is placed.

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

Legend:

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

    r9691 r9876  
    100100    }
    101101
    102     // Ensure the GLI user directory exists
    103     File gli_user_directory = Utility.getGLIUserFolder();
    104     if (!gli_user_directory.exists()) {
    105         gli_user_directory.mkdirs();
    106     }
    107 
    108102    String gwcgi = getParameter("gwcgi");
    109103    String library_cgi = fullLibraryURL(gwcgi);
     
    111105    String cgi_base = library_cgi.substring(0,cgi_base_cut+1);
    112106
     107        String windows_home = getParameter("windowsHome");
     108        File gli_user_directory = Utility.setGLIUserFolder(windows_home);
     109    if (!gli_user_directory.exists()) {
     110        gli_user_directory.mkdirs();
     111    }
     112
    113113    gatherer = new Gatherer();
    114114
     
    118118
    119119    GetOpt go = new GetOpt(args);
     120
     121        String debug_param = getParameter("debug");
     122
     123        if ((debug_param != null) && (debug_param.matches("true"))) {
     124            go.debug = true;
     125        }
    120126
    121127    if (go.feedback_enabled) {
  • trunk/gli/src/org/greenstone/gatherer/util/Utility.java

    r9437 r9876  
    122122    static final public String XML_DIRECTORY = "xml" + File.separator;
    123123
     124    static protected File gli_user_folder = null;
     125
    124126    // These are out of alphabetic order to avoid forward reference error.
    125127    /** The default icon to produce a 'help-icon' sized blank space before a menu entry. */
     
    407409    static final private String WIN_GLI_CONFIG_FOLDER = "Greenstone" + File.separator + "GLI";
    408410
     411    static public File setGLIUserFolder(String windows_home) {
     412        gli_user_folder = null;
     413        if(Utility.isWindows()) {
     414            if ((windows_home != null) && (windows_home != "")) {
     415                gli_user_folder = new File(windows_home + File.separator + "GLI" + File.separator);
     416            }
     417            else {
     418                gli_user_folder = new File(System.getProperty(USER_HOME_PROPERTY) + File.separator + APPLICATION_DATA_FOLDER + File.separator + WIN_GLI_CONFIG_FOLDER + File.separator);
     419            }
     420        }
     421        else {
     422            gli_user_folder = new File(System.getProperty(USER_HOME_PROPERTY) +
     423File.separator + UNIX_GLI_CONFIG_FOLDER + File.separator);
     424        }
     425        return gli_user_folder;
     426    }
     427
    409428    static public File getGLIUserFolder()
    410429    {
    411     if (Utility.isWindows()) {
    412         return new File(System.getProperty(USER_HOME_PROPERTY) + File.separator + APPLICATION_DATA_FOLDER + File.separator + WIN_GLI_CONFIG_FOLDER + File.separator);
    413     }
    414     else {
    415         return new File(System.getProperty(USER_HOME_PROPERTY) + File.separator + UNIX_GLI_CONFIG_FOLDER + File.separator);
    416     }
     430    return gli_user_folder;
    417431    }
    418432
Note: See TracChangeset for help on using the changeset viewer.