Changeset 10342 for trunk/gli/src/org/greenstone/gatherer/util
- Timestamp:
- 2005-07-28T15:50:17+12:00 (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gli/src/org/greenstone/gatherer/util/Utility.java
r10330 r10342 65 65 /** The size of the io buffer, in bytes. */ 66 66 static final public int BUFFER_SIZE = 1024; 67 /** Definition of an important directory name, in this case the base dir, or the working directory of the Gatherer. */68 69 static public String BASE_DIR = System.getProperty("user.dir") + File.separator;70 67 static final public String BUILD_CFG_FILENAME = "build.cfg"; 71 68 static final public String CFG_COLLECTIONMETA_COLLECTIONNAME = "collectionmeta\tcollectionname"; … … 80 77 static final public String CFG_FORMAT = "format"; 81 78 static final public String CFG_MAINTAINER = "maintainer"; 82 /** Definition of an important directory name, in this case the parent directory of all the collections in the gsdl. */83 static final public String COL_DIR = "collect" + File.separator;84 79 static final public String COLLECTION_TREE = "Collection"; 85 80 /** Definition of an important directory name, in this case the file the collection configuration is expect to be in. */ … … 91 86 static final public String GLI_EXTENSION = ".col"; 92 87 93 static public String TMP_DIR = BASE_DIR + "tmp" + File.separator;94 95 88 /** Definition of an important directory name, in this case the images directory for the collection. */ 96 89 static final public String IMAGES_DIR = "images" + File.separator; … … 99 92 /** Definition of an important directory name, in this case the backup import directory for the collection. */ 100 93 static final public String IMPORT_BAK_DIR = "import.bak" + File.separator; 101 /** Definition of an important directory name, in this case the log directory for the collection. */102 static final public String LOG_DIR = "log" + File.separator;103 94 /** Definition of an important directory name, in this case the macros directory for the collection. */ 104 95 static final public String MACROS_DIR = "macros" + File.separator; 105 96 /** Definition of an important directory name, in this case the location of the expected collection metadata sets.. */ 106 97 static final public String META_DIR = "metadata" + File.separator; // Col. Copy 107 /** Definition of an important directory name, in this case the location of the default metadata sets. */108 static public String METADATA_DIR = BASE_DIR + "metadata" + File.separator;109 98 /** Definition of an important zip file, in this case zipped up version of metadata file stored in JAR file */ 110 99 static final public String METADATA_ZIP = "metadata.zip"; … … 119 108 static final public String PROGRAM_VERSION = "v2.60"; 120 109 static final public String WORKSPACE_TREE = "Workspace"; 121 static final public String XML_DIRECTORY = "xml" + File.separator;122 123 static protected File gli_user_folder = null;124 110 125 111 … … 326 312 327 313 328 /** Builds the cache dir by appending the user path and 'cache'.329 * @return a File representing the path to the private file cache within the current collection.330 */331 public static File getCacheDir() {332 return new File(getGLIUserFolder(), StaticStrings.CACHE_FOLDER);333 }334 335 336 /** Method which constructs the configuration file given a certain collection.337 * @param col_dir The location of the collection directory as a <strong>String</strong>.338 * @return The location of the given collections configuration file, also as a <strong>String</strong>.339 */340 static public String getConfigFile(String col_dir) {341 return col_dir + CONFIG_FILE;342 }343 344 314 static public String getDateString() { 345 315 Calendar current = Calendar.getInstance(); … … 381 351 382 352 383 static final private String APPLICATION_DATA_FOLDER = "Application Data";384 static final private String UNIX_GLI_CONFIG_FOLDER = ".gli";385 static final private String USER_HOME_PROPERTY = "user.home";386 static final private String WIN_GLI_CONFIG_FOLDER = "Greenstone" + File.separator + "GLI";387 388 static public File setGLIUserFolder(String windows_home) {389 gli_user_folder = null;390 if(Utility.isWindows()) {391 if ((windows_home != null) && (windows_home != "")) {392 gli_user_folder = new File(windows_home + File.separator + "GLI" + File.separator);393 }394 else {395 gli_user_folder = new File(System.getProperty(USER_HOME_PROPERTY) + File.separator + APPLICATION_DATA_FOLDER + File.separator + WIN_GLI_CONFIG_FOLDER + File.separator);396 }397 }398 else {399 gli_user_folder = new File(System.getProperty(USER_HOME_PROPERTY) +400 File.separator + UNIX_GLI_CONFIG_FOLDER + File.separator);401 }402 return gli_user_folder;403 }404 405 static public File getGLIUserFolder()406 {407 return gli_user_folder;408 }409 410 411 /** Method which constructs the import directory given a certain collection.412 * @param col_dir The location of the collection directory as a <strong>String</strong>.413 * @return The location of the given collections import directory, also as a <strong>String</strong>.414 */415 public static String getImportDir(String col_dir) {416 return col_dir + IMPORT_DIR;417 }418 419 /** Method which constructs the log directory given a certain collection.420 * @param col_dir The location of the collection directory as a <strong>String</strong>.421 * @return The location of the given collections log directory, also as a <strong>String</strong>.422 */423 public static String getLogDir(String col_dir) {424 if(col_dir != null) {425 return col_dir + LOG_DIR;426 }427 else {428 return getGLIUserFolder().getAbsolutePath() + File.separator + LOG_DIR;429 }430 }431 353 /** Determine this machines name. 432 354 * @return The name as a <strong>String</strong>.
Note:
See TracChangeset
for help on using the changeset viewer.