- Timestamp:
- 2010-08-30T16:29:40+12:00 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/trunk/gli/src/org/greenstone/gatherer/greenstone/LocalLibraryServer.java
r22771 r22806 694 694 } 695 695 696 // We're in the constructor, so we'll be running the LLS the first time, if we're 697 // running *server.exe* and if the current collect dir at Local Lib's startup is 698 // anything other than the default GS collect dir, then use that: 699 if (isPersistentServer) { // server.exe, so we're dealing with a local GS2 700 String collectDir = Configuration.getString("general.open_collection_gs2", true); 701 702 // If opening a collection outside the standard GS collect folder, need 703 // to open the non-standard collect folder that the collection resides in 704 if (!collectDir.startsWith(Gatherer.getDefaultGSCollectDirectoryPath())) { 705 File collectFolder = null; 706 if(!collectDir.endsWith("gli.col")) { // then it's a collect folder 707 collectFolder = new File(collectDir); 708 } else { 709 // the filepath is a gli.col file. To get the collect folder: the 1st level 710 // up is collection folder, 2 two levels up is the containing collect folder 711 collectFolder = new File(collectDir).getParentFile().getParentFile(); 696 // GS2. We're in the constructor, so we'll be running the LLS the first time 697 // Set the correct collectdir (from last time) before the server is started up 698 String collectDir = Configuration.getString("general.open_collection_gs2", true); 699 String defaultColDir = Gatherer.getDefaultGSCollectDirectoryPath(false); // no file separator at end 700 // If opening a collection outside the standard GS collect folder, need 701 // to open the non-standard collect folder that the collection resides in 702 if (!collectDir.startsWith(defaultColDir + File.separator)) { 703 File collectFolder = null; 704 if(!collectDir.endsWith("gli.col")) { // then it's a collect folder 705 collectFolder = new File(collectDir); 706 } else { 707 // the filepath is a gli.col file. To get the collect folder: the 1st level 708 // up is collection folder, 2 two levels up is the containing collect folder 709 collectFolder = new File(collectDir).getParentFile().getParentFile(); 710 } 711 712 // Need to deal with colgroups as well: while there's an etc/collect.cfg 713 // in the current collectFolder, move one level up 714 if(new File(collectFolder.getAbsolutePath()+File.separator+Utility.CONFIG_FILE).exists()) { 715 collectFolder = collectFolder.getParentFile(); 716 } 717 718 // if the collectdir from last time no longer exists this time, 719 // go back to Greenstone default collect dir 720 if(collectFolder.exists()) { 721 collectDir = collectFolder.getAbsolutePath(); 722 if(collectDir.endsWith(File.separator)) { 723 collectDir = collectDir.substring(0, collectDir.length()-1); 712 724 } 713 714 // Need to deal with colgroups as well: while there's an etc/collect.cfg in the current715 // collectFolder, move one level up716 if(new File(collectFolder.getAbsolutePath()+File.separator+Utility.CONFIG_FILE).exists()) {717 collectFolder = collectFolder.getParentFile();718 }719 collectDir = collectFolder.getAbsolutePath();720 721 // write out the non-standard collectDir (minus file separator at end) to the lls site conf722 // file being used723 if(collectDir.endsWith(File.separator)) {724 collectDir = collectDir.substring(0, collectDir.length());725 }725 } else { 726 collectDir = defaultColDir; 727 // necessary for local apache web server: update gsdlsite.cfg with the reverted collectdir 728 String gsdlsitecfg = Configuration.gsdl_path + File.separator 729 + "cgi-bin" + File.separator + "gsdlsite.cfg"; 730 Utility.updatePropertyConfigFile(gsdlsitecfg, "collecthome", collectDir); // no file separator at end 731 } 732 733 // if we're running *server.exe* and if the current collect dir at Local Lib's startup 734 // is anything other than the default GS collect dir or if we changed back to the default 735 // collect dir because the non-standard collectDir didn't exist, then write out 736 // the new collectDir (minus file separator at end) to the lls site conf in use 737 if (isPersistentServer) { // server.exe, so we're dealing with a local GS2 726 738 put(COLLECTHOME, collectDir); 727 739 save(); 728 740 lastModified = configFile.lastModified(); 729 741 } 742 730 743 } // now the correct current collect dir will get loaded when the server is started up hereafter 731 744 }
Note:
See TracChangeset
for help on using the changeset viewer.