Ignore:
Timestamp:
2011-10-17T22:52:27+13:00 (13 years ago)
Author:
ak19
Message:

Undoing previous commit to gsdlsite.cfg.in and gsicontrol.bat where a tab separated gsdlhome property key from its value, so that spaces in the filepath could be preserved on Windows. The new method first puts back gsicontrol.bat to how it used to read the gsdlhome property line and parse it differently in order to get the gsdlhome value correctly if there are spaces in it.

Location:
main/trunk/greenstone2
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone2/cgi-bin/gsdlsite.cfg.in

    r24759 r24765  
    55# points to the GSDLHOME directory
    66# This must be set, and must point to the top level Greenstone directory
    7 # (usually gsdl or Greenstone).
    8 # Put quotes around the GSDLHOME path value if it contains any spaces.
    9 # It's important that Tab(s) and not any spaces are used (as a delimiter)
    10 # to separate the gsdlhome property key from its value, since the value
    11 # is a filepath and can therefore contain spaces of its own.
    12 gsdlhome    **GSDLHOME**
     7# (usually gsdl or Greenstone)
     8gsdlhome    **GSDLHOME**
    139
    1410# this is the http address of GSDLHOME
  • main/trunk/greenstone2/gsicontrol.bat

    r24759 r24765  
    184184if not exist "%GSDLHOME%\%cgibin%\gsdlsite.cfg" goto relocate
    185185
    186 :: In gsdlsite.cfg, the tab char (and only the tab char) NEEDS to be the
    187 :: delimiter between the gsdlhome property name and its value, the path.
    188 :: The tab as delimiter is necessary just for that property line, since
    189 :: the path can contain spaces and we therefore can't have space as delim.
    190 FOR /F "tokens=2 delims=    " %%G IN ('findstr /R ^gsdlhome "%GSDLHOME%\%cgibin%\gsdlsite.cfg"') do set gshome=%%G
     186set gshome=
     187FOR /F "tokens=*" %%G IN ('findstr /R ^gsdlhome "%GSDLHOME%\%cgibin%\gsdlsite.cfg"') do (call :concat %%G)
     188
     189:: The following doesn't work if there are spaces in the gsdlhome filepath
     190::FOR /F "tokens=2" %%G IN ('findstr /R ^gsdlhome "%GSDLHOME%\%cgibin%\gsdlsite.cfg"') do set gshome=%%G
    191191:: before string comparison, remove any quotes around gsdlhome value defined in config file
    192 if not [%gshome%] == [] set gshome=%gshome:"=%
     192:: if not [%gshome%] == [] set gshome=%gshome:"=%
     193
    193194if "%gshome%" == "%GSDLHOME%" set gshome=& goto exit
    194195 
     
    207208::for %%G in (gs2-server.app gli.app client-gli.app gems.app) do if exist "%%G\Contents\document.wflow" del "%%G\Contents\document.wflow"
    208209goto cfgweb
     210
     211:: Subroutine used to glue parts of a filepath that contains spaces back together again
     212:: http://www.computing.net/answers/programming/batch-for-loop-tokens/16727.html
     213:concat
     214:: first remove any quotes around this part of the filepath
     215set suffix=%~1
     216if not "%suffix%" == "gsdlhome" set gshome=%gshome%%suffix%
     217shift
     218if not "%~1"=="" goto concat
     219goto :eof
    209220
    210221
     
    292303if "%safepath%" == "" for /F "delims=*" %%T in ('"echo %GSDLHOME%| %_sed% s@\\@\/@g"') do set safepath=%%T
    293304
    294 if exist "%GSDLHOME%\%cgibin%\gsdlsite.cfg" FOR /F "tokens=2" %%G IN ('findstr /R ^collecthome "%GSDLHOME%\%cgibin%\gsdlsite.cfg"') do set COLLECTHOME=%%G
     305:: Doesn't work if there are spaces in the collecthome path in gsdlsite.cfg
     306::if exist "%GSDLHOME%\%cgibin%\gsdlsite.cfg" FOR /F "tokens=2" %%G IN ('findstr /R ^collecthome "%GSDLHOME%\%cgibin%\gsdlsite.cfg"') do set COLLECTHOME=%%G
     307
     308:: variable in subroutine concat is called gshome,
     309:: so forced to use it here for collecthome
     310set gshome=
     311if exist "%GSDLHOME%\%cgibin%\gsdlsite.cfg" FOR /F "tokens=*" %%G IN ('findstr /R ^gsdlhome "%GSDLHOME%\%cgibin%\gsdlsite.cfg"') do (call :concat %%G)
     312set COLLECTHOME=%gshome%
     313set gshome=
     314
    295315if "%COLLECTHOME%" == "" set COLLECTHOME=%GSDLHOME%\collect
    296316for /F "delims=*" %%T in ('"echo %COLLECTHOME%| %_sed% s@\\@\/@g"') do set safecollectpath=%%T
Note: See TracChangeset for help on using the changeset viewer.