Changeset 24008


Ignore:
Timestamp:
2011-05-09T20:02:09+12:00 (13 years ago)
Author:
ak19
Message:

lucenesearch needs to use a temporary folder to write out a file to. The windows TEMP envvar is not available through the apache webserver without passenv. This seems to be the only option, as the _tempnam and _tmpnam windows methods either try to write to the current working directory or, if they take a dir parameter, will also look in TMP and else use whatever folder you provide. We need to use the TEMP folder *because* we don't know what folder to provide (the collect folder won't be writable if GS is installed on and run from non-writable media like a CD-ROM.

Location:
main/trunk/greenstone2/runtime-src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone2/runtime-src/packages/apache-httpd/windows-httpd.conf.in

    r23732 r24008  
    5050# USERPROFILE environment variable in order for open-office to process docs
    5151# It also requires ProgramFiles to guess where the OpenOffice bin is installed
    52 PassEnv "USERPROFILE" "ProgramFiles" LANG
     52# The TEMP envvar is needed by lucenesearch.cpp so it can write out files
     53# to the TEMP windows folder in case GS is installed on a non-writable media
     54# like a CD-ROM.
     55PassEnv "USERPROFILE" "ProgramFiles" LANG "TEMP"
    5356
    5457#
  • main/trunk/greenstone2/runtime-src/src/colservr/lucenesearch.cpp

    r23776 r24008  
    170170  // a location designed to be writable
    171171
    172   text_t out_file = filename_cat(getenv("TEMP"),filename);
     172  // Need to set the Apache server to pass the TEMP envvar (or TMP) with
     173  // passenv. Little point using _tempnam() function that generates a
     174  // filename and where you need to pass in the dir if *TMP* doesn't exist. 
     175  // http://msdn.microsoft.com/en-us/library/hs3e7355%28v=vs.80%29.aspx
     176  // dir parameter: "The path used in the file name if there is no TMP
     177  // environment variable, or if TMP is not a valid directory." Seems
     178  // the inverse of what we want: to use TMP/TEMP if collectdir is invalid.
     179
     180  text_t out_file = filename_cat(getenv("TEMP"),filename); // TMP or TEMP
    173181
    174182  cmd += " -out \"" + out_file + "\"";
Note: See TracChangeset for help on using the changeset viewer.