Ignore:
Timestamp:
2008-07-09T13:12:15+12:00 (16 years ago)
Author:
davidb
Message:

Introduction of 'collecthome' which parallels 'gsdlhome' to allow the toplevel collect folder to be outside of the gsdlhome area

File:
1 edited

Legend:

Unmodified
Added
Removed
  • gsdl/trunk/src/recpt/receptionist.cpp

    r15589 r16310  
    5252void recptconf::clear () {
    5353  gsdlhome.clear();
     54  collecthome.clear();
    5455  dbhome.clear();
    5556  collectinfo.erase(collectinfo.begin(), collectinfo.end());
     
    222223      if (configinfo.dbhome.empty()) configinfo.dbhome = cfgline[0];
    223224    }
     225    else if (key == "collecthome") configinfo.collecthome = cfgline[0];
    224226    else if (key == "gdbmhome") configinfo.dbhome = cfgline[0];
    225227    else if (key == "collection") {
     
    231233      }
    232234     
    233     } else if (key == "collectdir") configinfo.collectdir = cfgline[0];
     235    }
     236    else if (key == "collectdir") configinfo.collectdir = cfgline[0];
    234237    else if (key == "httpprefix") configinfo.httpprefix = cfgline[0];
    235238    else if (key == "httpimg") configinfo.httpimg = cfgline[0];
     
    269272    else if (key == "macroprecedence") configinfo.macroprecedence = cfgline[0];
    270273    else if (key == "collectinfo") {
    271       if (cfgline.size() >= 3) {
     274      if (cfgline.size() == 3) {
     275    // for backwards compatability with older collections that only use
     276    // gsdlhome and dbhome
    272277    collectioninfo_t cinfo;
    273278    cinfo.gsdl_gsdlhome = cfgline[1];
     279    cinfo.gsdl_collecthome = filename_cat(cfgline[1],"collect");
    274280    cinfo.gsdl_dbhome = cfgline[2];
     281    configinfo.collectinfo[cfgline[0]] = cinfo;
     282      }
     283      else if (cfgline.size() >= 4) {
     284    collectioninfo_t cinfo;
     285    cinfo.gsdl_gsdlhome = cfgline[1];
     286    cinfo.gsdl_collecthome = cfgline[2];
     287    cinfo.gsdl_dbhome = cfgline[3];
    275288    configinfo.collectinfo[cfgline[0]] = cinfo;
    276289      }
     
    427440
    428441  // first configure collectdir
    429   text_t thecollectdir = configinfo.gsdlhome;
    430442  if (!configinfo.collection.empty()) {
     443
    431444    // collection specific mode
     445
     446    text_t collectdir = configinfo.gsdlhome;
     447
    432448    if (!configinfo.collectdir.empty()) {
    433449      // has already been configured
    434       thecollectdir = configinfo.collectdir;
     450      collectdir = configinfo.collectdir;
    435451    } else {
     452
    436453      // decide where collectdir is by searching for collect.cfg
    437454      // look in $GSDLHOME/collect/collection-name/etc/collect.cfg and
    438455      // then $GSDLHOME/etc/collect.cfg
    439       thecollectdir = filename_cat (configinfo.gsdlhome, "collect");
    440       thecollectdir = filename_cat (thecollectdir, configinfo.collection);
    441       text_t filename = filename_cat (thecollectdir, "etc");
     456      collectdir = filename_cat (configinfo.gsdlhome, "collect");
     457      collectdir = filename_cat (collectdir, configinfo.collection);
     458      text_t filename = filename_cat (collectdir, "etc");
    442459      filename = filename_cat (filename, "collect.cfg");
    443 
    444       if (!file_exists(filename)) thecollectdir = configinfo.gsdlhome;
    445     }
    446   }
    447   configure("collectdir", thecollectdir);
     460     
     461      if (!file_exists(filename)) collectdir = configinfo.gsdlhome;
     462    }
     463
     464    configure("collectdir", collectdir);
     465
     466  }
     467  else {
     468
     469    text_t collecthome;
     470    if (configinfo.collecthome.empty()) {
     471      collecthome = filename_cat(configinfo.gsdlhome,"collect");
     472    }
     473    else {
     474      collecthome = configinfo.collecthome;
     475    }
     476
     477    configure("collecthome", collecthome);
     478
     479    // for backwards compatability collectdir set to gsdlhome
     480    // (possible it could now be removed)
     481    configure("collectdir", configinfo.gsdlhome);
     482  }
     483
    448484
    449485  // read in the macro files
     
    824860    collectname=args["c"];
    825861    if (collectname != "") {
    826       text_t collectdir=filename_cat(configinfo.gsdlhome,"collect");
    827       collectdir=filename_cat(collectdir,collectname);
     862
     863      text_t collecthome;
     864      if (!configinfo.collecthome.empty()) {
     865    collecthome = configinfo.collecthome;
     866      }   
     867      else {
     868    collecthome=filename_cat(configinfo.gsdlhome,"collect");
     869      }
     870      text_t collectdir=filename_cat(collecthome,collectname);
     871     
    828872      text_t buildcfg=filename_cat(collectdir,"index");
    829873      buildcfg=filename_cat(buildcfg,"build.cfg");
     
    11861230
    11871231  text_t colmacrodir
    1188     = filename_cat (configinfo.gsdlhome,"collect",collection, "macros");
     1232    = filename_cat (configinfo.collecthome,collection, "macros");
    11891233
    11901234  if (directory_exists (colmacrodir)) {
Note: See TracChangeset for help on using the changeset viewer.