Ignore:
Timestamp:
2005-02-15T15:39:48+13:00 (19 years ago)
Author:
mdewsnip
Message:

Made major rearrangements to the way path variables are calculated. This is to facilitate being able to specify a "-collectdir" argument to the GLI so one GLI installation can be used in a networked, multi-user situation. Hope I haven't broken anything!

Location:
trunk/gli/src/org/greenstone/gatherer/gui
Files:
6 edited

Legend:

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

    r9018 r9045  
    215215    private void scanForCollections() {
    216216    // Start at the collect dir.
    217     File collect_directory;
    218     if (Gatherer.GS3) {
    219         collect_directory = new File(Utility.getCollectDir(Configuration.gsdl3_path, Configuration.site_name));
    220     } else {
    221         collect_directory = new File(Utility.getCollectDir(Configuration.gsdl_path));
    222     }
    223     if(collect_directory.exists()) {
     217    File collect_directory = new File(Gatherer.getCollectDirectoryPath());
     218    if (collect_directory.exists()) {
    224219        // Now for each child directory see if it contains a .col file and
    225220        // if so try to load it..
  • trunk/gli/src/org/greenstone/gatherer/gui/ExportCollectionPrompt.java

    r9018 r9045  
    335335    private void scanForCollections() {
    336336    // Start at the collect dir.
    337     File collect_directory;
    338     if (Gatherer.GS3) {
    339         collect_directory = new File(Utility.getCollectDir(Configuration.gsdl3_path, Configuration.site_name));
    340     } else {
    341         collect_directory = new File(Utility.getCollectDir(Configuration.gsdl_path));
    342     }
    343     if(collect_directory.exists()) {
     337    File collect_directory = new File(Gatherer.getCollectDirectoryPath());
     338    if (collect_directory.exists()) {
    344339        // Now for each child directory see if it contains a .col file and
    345340        // if so try to load it..
  • trunk/gli/src/org/greenstone/gatherer/gui/GUIManager.java

    r9035 r9045  
    621621    }
    622622    else if(user_choice == SimpleOpenCollectionDialog.BROWSE_OPTION) {
    623         File file;
     623        File collect_directory;
    624624        if (Gatherer.GS3) {
    625         if (Configuration.gsdl3_path != null) {
    626             file = new File(Utility.getSitesDir(Configuration.gsdl3_path));
    627         } else {
    628             file = new File(Utility.BASE_DIR);
    629         }
    630 
    631         } else {
    632 
    633         if(Configuration.gsdl_path != null) {
    634             file = new File(Utility.getCollectDir(Configuration.gsdl_path));
    635         }
    636         else {
    637             file = new File(Utility.BASE_DIR);
    638         }
    639         }
    640         OpenCollectionDialog chooser = new OpenCollectionDialog(file);
    641         file = null;
     625        collect_directory = new File(Utility.getSitesDir(Configuration.gsdl3_path));
     626        }
     627        else {
     628        collect_directory = new File(Gatherer.getCollectDirectoryPath());
     629        }
     630        OpenCollectionDialog chooser = new OpenCollectionDialog(collect_directory);
    642631        filename = chooser.getFileName();
    643632        chooser.destroy();
  • trunk/gli/src/org/greenstone/gatherer/gui/NewCollectionDetailsPrompt.java

    r8803 r9045  
    4949        return false;
    5050    }
    51     File collection_directory;
    52     if (Gatherer.GS3) {
    53         collection_directory = new File(Utility.getCollectDir(Configuration.gsdl3_path, Configuration.site_name));
    54     } else {
    55         collection_directory = new File(Utility.getCollectDir(Configuration.gsdl_path));
    56     }
    57     File children[] = collection_directory.listFiles();
     51    File collect_directory = new File(Gatherer.getCollectDirectoryPath());
     52    File children[] = collect_directory.listFiles();
    5853    for(int i = 0; children != null && i < children.length; i++) {
    5954        if(children[i].isDirectory()) {
     
    10297    // need to modify this to base a coll on any collection from any site
    10398    if (Gatherer.GS3) {
    104         File sites_dir = new File(Utility.getSitesDir(Configuration.gsdl3_path));
     99        File sites_dir = new File(Gatherer.getSitesDirectoryPath());
    105100        File [] sites = sites_dir.listFiles();
    106101        for (int i=0; i<sites.length; i++) {
    107         File collect_dir = new File(Utility.getCollectDir(Configuration.gsdl3_path, sites[i].getName()));
    108         if (collect_dir.exists()) {
    109             addCollectionsToModel(base_collection_model, collect_dir, sites[i].getName());
     102        File collect_directory = new File(sites_dir + sites[i].getName() + File.separator + "collect");
     103        if (collect_directory.exists()) {
     104            addCollectionsToModel(base_collection_model, collect_directory, sites[i].getName());
    110105        }
    111106        }
    112107    } else {
    113        File gsdl_collection_directory = new File(Utility.getCollectDir(Configuration.gsdl_path));
    114        addCollectionsToModel(base_collection_model, gsdl_collection_directory, null);
     108       File collect_directory = new File(Gatherer.getCollectDirectoryPath());
     109       addCollectionsToModel(base_collection_model, collect_directory, null);
    115110    }
    116111
     
    266261    }
    267262   
    268     private boolean filenameClashes(String filename) {
    269     File collection_directory;
    270     if (Gatherer.GS3) {
    271         collection_directory = new File(Utility.getCollectDir(Configuration.gsdl3_path, Configuration.site_name));
    272     } else {
    273         collection_directory = new File(Utility.getCollectDir(Configuration.gsdl_path));
    274     }
    275 
    276     File children[] = collection_directory.listFiles();
     263    private boolean filenameClashes(String filename)
     264    {
     265    File collect_directory = new File(Gatherer.getCollectDirectoryPath());
     266    File children[] = collect_directory.listFiles();
    277267    for(int i = 0; children != null && i < children.length; i++) {
    278268        if(children[i].getName().equals(filename)) {
  • trunk/gli/src/org/greenstone/gatherer/gui/OptionsPane.java

    r8313 r9045  
    236236        // Build a list of the log files available, ordering by last modified. Log files are like build_log.date.txt
    237237        DefaultListModel contents = new DefaultListModel();
    238         File log_directory = new File(Gatherer.c_man.getCollectionLog());
     238        File log_directory = new File(Gatherer.c_man.getCollectionLogDirectoryPath());
    239239        File children[] = log_directory.listFiles();
    240240        for(int i = 0; children != null && i < children.length; i++) {
     
    289289    name.append(".txt");
    290290    // just in case there is no log directory
    291     File file = new File(Gatherer.c_man.getCollectionLog() + name.toString());
     291    File file = new File(Gatherer.c_man.getCollectionLogDirectoryPath() + name.toString());
    292292    File parent_file = file.getParentFile();
    293293    parent_file.mkdirs();
  • trunk/gli/src/org/greenstone/gatherer/gui/SimpleOpenCollectionDialog.java

    r8243 r9045  
    264264    public CollectionListModel() {
    265265        data = new TreeSet();
    266         File collect_folder;
    267         if (Gatherer.GS3) {
    268         collect_folder = new File(Utility.getCollectDir(Configuration.gsdl3_path, Configuration.site_name) );
    269         } else {
    270         collect_folder = new File(Utility.getCollectDir(Configuration.gsdl_path));
    271         }
    272         if (!collect_folder.exists()) {
    273         collect_folder = null;
     266        File collect_directory = new File(Gatherer.getCollectDirectoryPath());
     267        if (!collect_directory.exists()) {
     268        collect_directory = null;
    274269        return;
    275270        }
    276         File[] collection_folders = collect_folder.listFiles();
     271        File[] collection_folders = collect_directory.listFiles();
    277272        for(int i = 0; i < collection_folders.length; i++) {
    278273        File collection_folder = collection_folders[i];
     
    290285        }
    291286        collection_folders = null;
    292         collect_folder = null;
     287        collect_directory = null;
    293288    }
    294289
Note: See TracChangeset for help on using the changeset viewer.