- 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/Gatherer.java
r22771 r22806 505 505 // If opening a collection outside the standard GS collect folder, need 506 506 // to open the non-standard collect folder that the collection resides in 507 if (open_collection_file_path != null && 508 !open_collection_file_path.startsWith(get CollectDirectoryPath())) {507 if (open_collection_file_path != null && 508 !open_collection_file_path.startsWith(getDefaultGSCollectDirectoryPath(true))) { 509 509 File collectFolder = null; 510 510 if(!open_collection_file_path.endsWith("gli.col")) { // then it's a collect folder … … 520 520 String cfg_file = (Gatherer.GS3)? Utility.CONFIG_GS3_FILE : Utility.CONFIG_FILE; 521 521 if(new File(collectFolder.getAbsolutePath()+File.separator+cfg_file).exists()) { // colgroup 522 collectFolder = collectFolder.getParentFile(); 523 524 } 525 setCollectDirectoryPath(collectFolder.getAbsolutePath()); // now set this as the current collect folder 526 } 527 528 } 529 catch (Exception exception) { 522 collectFolder = collectFolder.getParentFile(); 523 } 524 525 if(!isGsdlRemote && !collectFolder.exists()) { 526 // if dealing with a local server but the collectdir no longer exists, 527 // use the default greenstone collect directory, and write that to affected files 528 open_collection_file_path = null; // no longer have an open collection from last time if coldir doesn't exist 529 530 String defaultColDir = getDefaultGSCollectDirectoryPath(false); // no file separator at end 531 532 setCollectDirectoryPath(defaultColDir); // will ensure the required file separator at end 533 534 Configuration.setString("general.open_collection"+Configuration.gliPropertyNameSuffix(), 535 true, defaultColDir + File.separator); 536 537 if(Gatherer.GS3) { // GS2's gsdlsite.cfg was taken care of when LocalLibraryServer was started up 538 // (LocalLibraryServer would also already have set glisite.cfg to the correct collecthome) 539 String gsdlsitecfg = Configuration.gsdl3_path + File.separator 540 + "WEB-INF" + File.separator + "cgi" + File.separator + "gsdl3site.cfg"; 541 Utility.updatePropertyConfigFile(gsdlsitecfg, "collecthome", defaultColDir); // no file separator 542 } 543 } else { // remote GS or collect dir exists 544 setCollectDirectoryPath(collectFolder.getAbsolutePath()); // now set this as the current collect folder 545 } 546 } 547 } catch (Exception exception) { 530 548 DebugStream.printStackTrace(exception); 531 549 } … … 715 733 } 716 734 717 return getDefaultGSCollectDirectoryPath( );735 return getDefaultGSCollectDirectoryPath(true); // file separator appended 718 736 719 737 } 720 738 721 739 /** Returns the path of the Greenstone "collect" directory. */ 722 static public String getDefaultGSCollectDirectoryPath() { 723 if (!GS3) { 724 return Configuration.gsdl_path + "collect" + File.separator; 740 static public String getDefaultGSCollectDirectoryPath(boolean appendSeparator) { 741 String colDir; 742 if (GS3) { 743 colDir = getSitesDirectoryPath() + Configuration.site_name + File.separator + "collect"; 725 744 } 726 745 else { 727 return getSitesDirectoryPath() + Configuration.site_name + File.separator + "collect" + File.separator; 728 } 746 colDir = Configuration.gsdl_path + "collect"; 747 } 748 749 if(appendSeparator) { 750 colDir += File.separator; 751 } 752 return colDir; 729 753 } 730 754 … … 802 826 } 803 827 804 // first save any open collection in the *old* location828 // first save any open collection in the old location, then close it 805 829 if(Gatherer.c_man.getCollection() != null) { 806 Gatherer.setCollectDirectoryPath(oldCollectPath); // go back to current collection's location807 830 Gatherer.g_man.saveThenCloseCurrentCollection(); // close the current collection first 808 831 } … … 830 853 if(Gatherer.GS3) { // web/WEB-INF/cgi/gsdl3site.cfg 831 854 gsdlsitecfg = Configuration.gsdl3_path + File.separator + "WEB-INF" 832 + File.separator + "cgi" + File.separator + "gsdl3site.cfg";855 + File.separator + "cgi" + File.separator + "gsdl3site.cfg"; 833 856 } else { // cgi-bin/gsdlsite.cfg 834 857 gsdlsitecfg = Configuration.gsdl_path + File.separator 835 + "cgi-bin" + File.separator + "gsdlsite.cfg";858 + "cgi-bin" + File.separator + "gsdlsite.cfg"; 836 859 } 837 860
Note:
See TracChangeset
for help on using the changeset viewer.