Changeset 4292


Ignore:
Timestamp:
2003-05-21T14:00:33+12:00 (21 years ago)
Author:
sjboddie
Message:

server.exe now writes a "url" entry to its configuration file when it starts
up and removes it when it shuts down. This allows the gatherer (and
anything else that needs to) to detect if the server is running and to
know exactly what url it's using.

Location:
trunk/gsdl/src/w32server
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/gsdl/src/w32server/fnord.cpp

    r4289 r4292  
    142142void finish_up() {
    143143  // remember the current preferences
    144   write_settings();
     144  write_settings("");
    145145
    146146  // Shutdown the HTTP server
     
    320320  if (have_networking) {
    321321    text_t url = "http://" + text_t(localname);
     322
     323    gsdl_url = url;
     324    write_settings(gsdl_url);
     325
    322326    if (gsdl_port_num != 80)
    323327      url += ":" + text_t(gsdl_port_num);
    324    
     328
    325329    url += gsdl_enterlib;
    326330
     
    367371         "Failed to start your chosen browser. It seems that your\n"
    368372         "chosen browser has been removed or corrupted.\n"
    369          "Please check you browser choice by going to the\n"
     373         "Please check your browser choice by going to the\n"
    370374         "'Settings...' item under the 'File' menu.",
    371375         "Greenstone Digital Library Software", MB_OK);
  • trunk/gsdl/src/w32server/settings.cpp

    r2577 r4292  
    6262int gsdl_browser = GS_IEXPLORE;
    6363char gsdl_browser_exe[MAX_FILENAME_SIZE] = "";
    64 
     64text_t gsdl_url;
    6565
    6666// private data
     
    267267}
    268268
    269 void write_settings () {
     269void write_settings (const text_t url) {
    270270  char conffile[MAX_FILENAME_SIZE];
    271271 
     
    281281    // top (gsdl) level stuff
    282282    fout << "[gsdl]\n";
     283   
     284    if (!url.empty()) {
     285      // url entry should only be written to gsdlsite.cfg when the
     286      // server is actually running, not when it's stopped (since we
     287      // can't be sure what the url is at that stage). That is,
     288      // write_settings() is called with the url argument set when the
     289      // server first starts up, it's then called without url set as
     290      // the server shuts down.
     291      write_ini_line(fout, "url", url);     
     292    }
     293
    283294    write_ini_line(fout, "enterlib", gsdl_enterlib);
    284295    write_ini_line(fout, "gsdlhome", gsdl_gsdlhome);
     
    814825  // save the settings if we exited via the ok button
    815826  if (res == 1) {
    816     write_settings();
     827    write_settings(gsdl_url);
    817828    // reset httpprefix in case port number was changed
    818829    //    configure_httpprefix ();
  • trunk/gsdl/src/w32server/settings.h

    r2286 r4292  
    5757extern int gsdl_browser;
    5858extern char gsdl_browser_exe[MAX_FILENAME_SIZE];
     59extern text_t gsdl_url;
    5960
    6061void Settings_Dialog(HWND window, int netscapeneeded);
    6162
    6263void read_settings (int netscapeneeded);
    63 void write_settings ();
     64void write_settings (const text_t url);
    6465
    6566void gsdl_check_browser_settings (int netscapeneeded);
Note: See TracChangeset for help on using the changeset viewer.