Index: /trunk/gsdl/src/colservr/collectset.cpp
===================================================================
--- /trunk/gsdl/src/colservr/collectset.cpp	(revision 2343)
+++ /trunk/gsdl/src/colservr/collectset.cpp	(revision 2344)
@@ -42,5 +42,5 @@
 #include "colservrconfig.h"
 #include "recptconfig.h"
-
+#include "fileutil.h"
 #include "collectset.h"
 
@@ -53,110 +53,105 @@
   // cgiwrapper)
   if (site_cfg_read (gsdlhome, httpdomain, httpprefix)) {
-    collectdir = filename_cat (gsdlhome, "collect");
-
-    if (!read_dir (collectdir, collections)) {
-      cerr << "couldn't read collect directory - make sure gsdlhome field is correct in gsdlsite.cfg\n";
-      exit (1);
-    }
-  }
-    
-  text_tarray::const_iterator thiscol = collections.begin();
-  text_tarray::const_iterator endcol = collections.end();
-
-  while (thiscol != endcol) {
-    // ignore the modelcol
-    if (*thiscol == "modelcol") {
-      thiscol ++;
-      continue;
-    }
-
-    // Dummy call to add collection added 24/11/2000;
-    // we already do this ourselves! 
-    // this->add_collection(*thiscol, &recpt, gsdlghome, gsdlhome);
-
-    // read config file to see if built with mg or mgpp
-    text_t buildtype = "mg"; // mg is default
-    text_tarray cfgline;
-    text_t key;
-    text_t filename = filename_cat(collectdir, *thiscol, "index" , "build.cfg");
-    ifstream confin(filename.getcstr());
-
-    if (confin) {
-      while (read_cfg_line(confin, cfgline) >= 0) {
-	if (cfgline.size() ==2 ) {
-	  key = cfgline[0];
-	  cfgline.erase(cfgline.begin());
-	  if (key =="buildtype") {
-	    buildtype = cfgline[0];
-	    break;
+    if (directory_exists(gsdlhome)) {
+      collectdir = filename_cat (gsdlhome, "collect");
+      if (read_dir (collectdir, collections)) {
+    
+	text_tarray::const_iterator thiscol = collections.begin();
+	text_tarray::const_iterator endcol = collections.end();
+
+	while (thiscol != endcol) {
+	  // ignore the modelcol
+	  if (*thiscol == "modelcol") {
+	    thiscol ++;
+	    continue;
 	  }
+
+	  // read config file to see if built with mg or mgpp
+	  text_t buildtype = "mg"; // mg is default
+	  text_tarray cfgline;
+	  text_t key;
+	  text_t filename = filename_cat(collectdir, *thiscol, "index" , "build.cfg");
+	  ifstream confin(filename.getcstr());
+
+	  if (confin) {
+	    while (read_cfg_line(confin, cfgline) >= 0) {
+	      if (cfgline.size() ==2 ) {
+		key = cfgline[0];
+		cfgline.erase(cfgline.begin());
+		if (key =="buildtype") {
+		  buildtype = cfgline[0];
+		  break;
+		}
+	      }
+	    }
+	  }
+	  
+	  confin.close();
+    
+	  // this memory is created but never destroyed
+	  // we're also not doing any error checking to make sure we didn't
+	  // run out of memory
+	  collectserver *cserver = new collectserver();
+	  gdbmclass *gdbmhandler = new gdbmclass();
+    
+	  // add a null filter
+	  filterclass *filter = new filterclass ();
+	  cserver->add_filter (filter);
+	  
+	  // add a browse filter
+	  browsefilterclass *browsefilter = new browsefilterclass();
+	  browsefilter->set_gdbmptr (gdbmhandler);
+	  cserver->add_filter (browsefilter);
+	  
+	  if (buildtype == "mg") {
+	    mgsearchclass *mgsearch = new mgsearchclass();
+	    
+	    // add a query filter
+	    mgqueryfilterclass *queryfilter = new mgqueryfilterclass();
+	    queryfilter->set_gdbmptr (gdbmhandler);
+	    queryfilter->set_mgsearchptr (mgsearch);
+	    cserver->add_filter (queryfilter);
+	    
+	    // add a mg and gdbm source
+	    mggdbmsourceclass *mggdbmsource = new mggdbmsourceclass ();
+	    mggdbmsource->set_gdbmptr (gdbmhandler);
+	    mggdbmsource->set_mgsearchptr (mgsearch);
+	    cserver->add_source (mggdbmsource);
+	  }
+#ifndef __WIN32__
+	  
+	  else if (buildtype == "mgpp") {
+	    
+	    mgppsearchclass *mgsearch = new mgppsearchclass();
+	    
+	    // add a query filter
+	    mgppqueryfilterclass *queryfilter = new mgppqueryfilterclass();
+	    queryfilter->set_gdbmptr (gdbmhandler);
+	    queryfilter->set_mgsearchptr (mgsearch);
+	    cserver->add_filter (queryfilter);
+	    
+	    // add a mg and gdbm source
+	    mggdbmsourceclass *mggdbmsource = new mggdbmsourceclass ();
+	    mggdbmsource->set_gdbmptr (gdbmhandler);
+	    mggdbmsource->set_mgsearchptr (mgsearch);
+	    cserver->add_source (mggdbmsource);   
+	  }
+#endif
+	  
+	  // inform collection server and everything it contains about its
+	  // collection name
+	  cserver->configure ("collection", *thiscol);
+	  // AZIZ: added on 10/10/00
+	  //       the cserver object does not have a reference to gsdlhome
+	  cserver->configure ("gsdlhome", gsdlhome);
+    
+	  // GRB: removed    proto.add_collectserver (cserver);
+	  // GRB: added to build our own cservers list
+	  cservers.addcollectserver (cserver);
+
+	  thiscol ++;
 	}
       }
     }
-    
-    confin.close();
-
-    // this memory is created but never destroyed
-    // we're also not doing any error checking to make sure we didn't
-    // run out of memory
-    collectserver *cserver = new collectserver();
-    gdbmclass *gdbmhandler = new gdbmclass();
-    
-    // add a null filter
-    filterclass *filter = new filterclass ();
-    cserver->add_filter (filter);
-    
-    // add a browse filter
-    browsefilterclass *browsefilter = new browsefilterclass();
-    browsefilter->set_gdbmptr (gdbmhandler);
-    cserver->add_filter (browsefilter);
-    
-    if (buildtype == "mg") {
-       mgsearchclass *mgsearch = new mgsearchclass();
- 
-       // add a query filter
-       mgqueryfilterclass *queryfilter = new mgqueryfilterclass();
-       queryfilter->set_gdbmptr (gdbmhandler);
-       queryfilter->set_mgsearchptr (mgsearch);
-       cserver->add_filter (queryfilter);
-       
-       // add a mg and gdbm source
-       mggdbmsourceclass *mggdbmsource = new mggdbmsourceclass ();
-       mggdbmsource->set_gdbmptr (gdbmhandler);
-       mggdbmsource->set_mgsearchptr (mgsearch);
-       cserver->add_source (mggdbmsource);
-    }
-#ifndef __WIN32__
-
-    else if (buildtype == "mgpp") {
-
-      mgppsearchclass *mgsearch = new mgppsearchclass();
-
-      // add a query filter
-      mgppqueryfilterclass *queryfilter = new mgppqueryfilterclass();
-      queryfilter->set_gdbmptr (gdbmhandler);
-      queryfilter->set_mgsearchptr (mgsearch);
-      cserver->add_filter (queryfilter);
-      
-      // add a mg and gdbm source
-      mggdbmsourceclass *mggdbmsource = new mggdbmsourceclass ();
-      mggdbmsource->set_gdbmptr (gdbmhandler);
-      mggdbmsource->set_mgsearchptr (mgsearch);
-      cserver->add_source (mggdbmsource);   
-    }
-#endif
-
-    // inform collection server and everything it contains about its
-    // collection name
-    cserver->configure ("collection", *thiscol);
-    // AZIZ: added on 10/10/00
-    //       the cserver object does not have a reference to gsdlhome
-    cserver->configure ("gsdlhome", gsdlhome);
-    
-    // GRB: removed    proto.add_collectserver (cserver);
-    // GRB: added to build our own cservers list
-    cservers.addcollectserver (cserver);
-
-    thiscol ++;
   }
 }
Index: /trunk/gsdl/src/recpt/cgiwrapper.cpp
===================================================================
--- /trunk/gsdl/src/recpt/cgiwrapper.cpp	(revision 2343)
+++ /trunk/gsdl/src/recpt/cgiwrapper.cpp	(revision 2344)
@@ -513,5 +513,5 @@
   char *script_name = getenv("SCRIPT_NAME");
   if (script_name != NULL) recpt.configure("gwcgi", script_name);
-  else recpt.configure("gwcgi", "/cgi-bin/gw");
+  else recpt.configure("gwcgi", "/gsdl");
 
   // read in the configuration files.
@@ -523,8 +523,11 @@
     // no gsdlhome in gsdlsite.cfg
     page_errorsitecfg (errorpage, debug, 1);
+  } else if (!directory_exists(gsdlhome)) {
+    // gsdlhome not a valid directory
+    page_errorsitecfg (errorpage, debug, 1);
   } else if (!main_cfg_read (recpt, gsdlhome, collection)) {
     // couldn't find the main configuration file
     page_errormaincfg (gsdlhome, collection, debug, errorpage);
-  } else  if (configinfo.collectinfo.empty() && false) {  // GRB: TODO: *** THIS WAS COMMENTED OUT TO MAKE CORBA WORK 7/9/2000 ****
+  } else  if (configinfo.collectinfo.empty() && false) { // commented out for corba
     // don't have any collections
     page_errorcollect (gsdlhome, errorpage, debug);
Index: /trunk/gsdl/src/recpt/librarymain.cpp
===================================================================
--- /trunk/gsdl/src/recpt/librarymain.cpp	(revision 2343)
+++ /trunk/gsdl/src/recpt/librarymain.cpp	(revision 2344)
@@ -70,5 +70,4 @@
   collectset  *cservers;
 #if defined(USE_Z3950)
-  /*#ifndef __WIN32__*/
   z3950proto   zproto;
 #endif
@@ -77,6 +76,4 @@
   cservers = new collectset(gsdlhome);
 
-  // GRB: removed 7/9/2000; perhaps needs to be here!site_cfg_read (gsdlhome);
-
   // set up the null protocol
   nproto.set_collectset(cservers);
@@ -84,92 +81,4 @@
   // configure the receptionist server list
   cservers->setReceptionistServers(recpt, gsdlhome);  
-  
-  
-  /*
-  text_t collectdir = filename_cat (gsdlhome, "collect");
-  text_tarray collections;
-  read_dir (collectdir, collections);
-
-  text_tarray::const_iterator thiscol = collections.begin();
-  text_tarray::const_iterator endcol = collections.end();
-
-  while (thiscol != endcol) {
-
-    // ignore the modelcol
-    if (*thiscol == "modelcol") {
-      thiscol ++;
-      continue;
-    }
-    
-    // create collection server and add to null protocol
-    nproto.add_collection (*thiscol, &recpt, gsdlhome, gsdlhome);
-    
-    confin.close();
-// #endif ? does this tie in with a WIN32 ifdef?
-
-    collectserver *cserver = new collectserver();
-    gdbmclass *gdbmhandler = new gdbmclass();
-
-    // add a null filter
-    filterclass *filter = new filterclass ();
-    cserver->add_filter (filter);
-    
-    // add a browse filter
-    browsefilterclass *browsefilter = new browsefilterclass();
-    browsefilter->set_gdbmptr (gdbmhandler);
-
-    cserver->add_filter (browsefilter);  
-
-    if (buildtype == "mg") {
-       mgsearchclass *mgsearch = new mgsearchclass();
- 
-       // add a query filter
-       mgqueryfilterclass *queryfilter = new mgqueryfilterclass();
-       queryfilter->set_gdbmptr (gdbmhandler);
-       queryfilter->set_mgsearchptr (mgsearch);
-       cserver->add_filter (queryfilter);
-       
-       // add a mg and gdbm source
-       mggdbmsourceclass *mggdbmsource = new mggdbmsourceclass ();
-       mggdbmsource->set_gdbmptr (gdbmhandler);
-       mggdbmsource->set_mgsearchptr (mgsearch);
-       cserver->add_source (mggdbmsource);
-    }
-#ifndef __WIN32__
-
-    else if (buildtype == "mgpp") {
-      
-      mgppsearchclass *mgsearch = new mgppsearchclass();
-
-      // add a query filter
-      mgppqueryfilterclass *queryfilter = new mgppqueryfilterclass();
-      queryfilter->set_gdbmptr (gdbmhandler);
-      queryfilter->set_mgsearchptr (mgsearch);
-      cserver->add_filter (queryfilter);
-      
-      // add a mg and gdbm source
-      mggdbmsourceclass *mggdbmsource = new mggdbmsourceclass ();
-      mggdbmsource->set_gdbmptr (gdbmhandler);
-      mggdbmsource->set_mgsearchptr (mgsearch);
-      cserver->add_source (mggdbmsource);
-   
-    }
-#endif    
-
-    // inform collection server and everything it contains about its
-    // collection name
-    cserver->configure ("collection", *thiscol);
-  
-    // configure receptionist's collectinfo structure 
-    text_tarray colinfo;
-    colinfo.push_back (*thiscol);
-    colinfo.push_back (gsdlhome);
-    colinfo.push_back (gsdlhome);
-    recpt.configure ("collectinfo", colinfo);
-    
-    nproto.add_collectserver (cserver);
-    thiscol ++;
-  }
-  */
 
   // add the protocol to the receptionist
@@ -178,5 +87,4 @@
   // z39.50 stuff - johnmcp
 #if defined(USE_Z3950)
-  /*#ifndef __WIN32__*/
   // add the z39.50 server information. Read in the file
   // etc/recpt/z3950.cfg for list of servers and their databases.
