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/colservr/filter.cpp

    r15587 r16310  
    2727#include "fileutil.h"
    2828#include <assert.h>
     29
     30#include <iostream>
     31using namespace std;
    2932
    3033
     
    4649    else if (key == "collectdir") collectdir = value;
    4750    else if (key == "gsdlhome") gsdlhome = value;
     51    else if (key == "collecthome") collecthome = value;
    4852    else if (key == "gdbmhome") dbhome = value;
    4953    else if ((key == "filteroptdefault") && (cfgline.size() == 2)) {
     
    5660  }
    5761}
     62
     63text_t filterclass::resolve_db_filename(const text_t& idx,
     64                    const text_t& file_ext)
     65{
     66  text_t resolved_filename;
     67
     68  if (gsdlhome==dbhome) {
     69    // dbhome has defaulted to gsdlhome which we take to means the
     70    // database has been specifically moved out of gsdlhome area.
     71    // => it should be whereever collecthome is set to
     72    resolved_filename = filename_cat(collecthome, collection, "index", "text", idx);
     73  }
     74  else {
     75    // dbhome is explicitly set to something other than gsdlhome
     76    // => use dbhome
     77    resolved_filename = filename_cat(dbhome, "collect", collection, "index", "text", idx);
     78  }
     79
     80  resolved_filename += file_ext;
     81
     82  return resolved_filename;
     83}
     84
    5885
    5986// init should be called after all the configuration is done but
     
    7097  }
    7198
     99  if (collecthome.empty()) collecthome = filename_cat(gsdlhome,"collect");
    72100  if (dbhome.empty()) dbhome = gsdlhome;
    73101 
    74102  // get the collection directory name
    75103  if (collectdir.empty()) {
    76     collectdir = filename_cat (gsdlhome, "collect", collection);
     104    collectdir = filename_cat (collecthome, collection);
    77105  }
    78106 
Note: See TracChangeset for help on using the changeset viewer.