Description
$prefixPath c:\some\path\somewhere is just a shortcut for $setEnv PATH c:\some\path\somewhere;%sysenv.PATH% that prevents the overflow of short strings N.B. the environment variable name used in %sysenv.name% is case-sensitive uses $prefixPath %sysenv.name% %sysenv.xx% will just truncate to 255 this may overflow and give an error
Small Model of Type : GAMS
Category : GAMS Test library
Main file : sysenv01.gms
$title 'Tests for path and system environment strings' (SYSENV01,SEQ=219)
$onDollar
$set pathsep :
$if NOT %system.filesys% == UNIX $set pathsep ;
* $prefixPath c:\some\path\somewhere
* is just a shortcut for
* $setEnv PATH c:\some\path\somewhere;%sysenv.PATH%
* that prevents the overflow of short strings
* N.B. the environment variable name used in %sysenv.name% is case-sensitive
* uses $prefixPath
* %sysenv.name%
* %sysenv.xx% will just truncate to 255
$set oldpath "%sysenv.PATH%"
$set prefix this is a prefix
$if NOT errorfree $exit
* this may overflow and give an error
$set newpath "%prefix%%pathsep%%oldpath%"
$if NOT errorfree $clearError
$prefixPath %prefix%
$set path "%sysenv.PATH%"
$if NOT errorfree $exit
display "path =", "%path%";
display "newpath =", "%newpath%";
$if NOT "%path%" == "%newpath%" $error prefix path is messed up