/* CD-env.cmd
 *
 * set up the environment for Suntan Special
 * add cdutils to the path
 * set temp in the environment (disabled, 2008)
 *
 * Copyright (C) 2001 Blonde Guy
 * All Rights Reserved
 */

originalDir = Directory()

Call RxFuncAdd 'SysLoadFuncs', 'RexxUtil', 'SysLoadFuncs'
Call SysLoadFuncs

/* load WPTOOLS (added 2024)
wptoolsLoaded = 0
if RxFuncAdd('WPToolsLoadFuncs', 'WPTOOLS', 'WPToolsLoadFuncs') = 1 then do
   wptoolsLoaded = 1
end
else do
   suntanDir = cdglobal('suntanDir')
   if RxFuncAdd('WPToolsLoadFuncs', suntanDir || '\wptools.dll', 'WPToolsLoadFuncs') = 1 then do
      wptoolsLoaded = 1
   end
end
if RxFuncQuery('WPToolsLoadFuncs') = 0 then do
   call WPToolsLoadFuncs
end  */

/* add current directory to system path if it isn't there */
systemPath = value('PATH',,'OS2ENVIRONMENT')
if right(systemPath,1) \= ';' then do
   systemPath = systemPath || ';'
end
utilPath = Directory()
if pos(utilPath, systemPath) = 0 then do
  systemPath = systemPath || utilPath
  call value "PATH", systemPath, "OS2ENVIRONMENT"
end

/* ensure tempdir is set (disabled, 2008)
TempDir = value('TEMP',,'OS2ENVIRONMENT')
if TempDir = '' then do
   TempDir = cdglobal('tempDir')   
   if directory(TempDir) = '' then do
      call LogCdi "Creating" TempDir
      call SysMkDir TempDir
   end
   call value 'TEMP', TempDir, 'OS2ENVIRONMENT'
end
*/
call Directory originalDir

return
