Changeset 16310 for gsdl/trunk/src/colservr/source.cpp
- Timestamp:
- 2008-07-09T13:12:15+12:00 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
gsdl/trunk/src/colservr/source.cpp
r15680 r16310 52 52 else if (key == "collectdir") collectdir = value; 53 53 else if (key == "gsdlhome") gsdlhome = value; 54 else if (key == "collecthome") collecthome = value; 54 55 else if (key == "gdbmhome") dbhome = value; 55 56 } … … 77 78 } 78 79 80 text_t sourceclass::resolve_db_filename(const text_t& idx, 81 const text_t& file_ext) 82 { 83 // This is an exact copy of the method (of the same name) in filterclass 84 // Makes sense to merge them, in which either gsdlhome, collecthome, 85 // dbhome, and collection need to also be passed in as parameters, 86 // or else there is some notion of a shared base class that both 87 // filter and source inherit from 88 89 // NB: there is an even greater opportunity to share more code in this 90 // function if sql_db_ptr/db_ptr and db_filename and sql_db_filename 91 // are also drawn from one object 92 93 text_t resolved_filename; 94 95 if (gsdlhome==dbhome) { 96 // dbhome has defaulted to gsdlhome which we take to means the 97 // database has been specifically moved out of gsdlhome area. 98 // => it should be whereever collecthome is set to 99 100 resolved_filename = filename_cat(collecthome, collection, "index", "text", idx); 101 } 102 else { 103 // dbhome is explicitly set to something other than gsdlhome 104 // => use dbhome 105 resolved_filename = filename_cat(dbhome, "collect", collection, "index", "text", idx); 106 } 107 108 resolved_filename += file_ext; 109 110 return resolved_filename; 111 } 112 113 114 79 115 // init should be called after all the configuration is done but 80 116 // before any other methods are called … … 83 119 outconvertclass text_t2ascii; 84 120 121 if (collecthome.empty()) collecthome = filename_cat(gsdlhome,"collect"); 85 122 if (dbhome.empty()) dbhome = gsdlhome; 86 123 … … 114 151 // get the collection directory name 115 152 if (collectdir.empty()) { 116 collectdir = filename_cat ( gsdlhome, "collect", collection);153 collectdir = filename_cat (collecthome, collection); 117 154 } 118 155 … … 128 165 indexstem = collection; 129 166 } 130 db_filename = filename_cat(dbhome, "collect", collection, "index", "text", indexstem); 131 db_filename += db_ptr->getfileextension(); 167 db_filename = resolve_db_filename(indexstem, db_ptr->getfileextension()); 132 168 if (!file_exists(db_filename)) { 133 169 logout << text_t2ascii
Note:
See TracChangeset
for help on using the changeset viewer.