unit frstunit;{ first unit of the Chromulan project
  (to make first actions before program starts) }
{
  (C) 2000 - 2001 Jindrich Jindrich, Pavel Pisa, PiKRON Ltd.

  Originators of the CHROMuLAN project:

  Jindrich Jindrich - http://www.jindrich.com
                      http://orgchem.natur.cuni.cz/Chromulan/
                      software developer, project coordinator
  Pavel Pisa        - http://cmp.felk.cvut.cz/~pisa
                      embeded software developer
  PiKRON Ltd.       - http://www.pikron.com
                      project initiator, sponsor, instrument developer

  The CHROMuLAN project is distributed under the GNU General Public Licence.
  See file COPYING for details.

  Originators reserve the right to use and publish sources
  under different conditions too. If third party contributors
  do not accept this condition, they can delete this statement
  and only GNU license will apply.
}

interface
uses SysUtils{v0.50}, WinUtl{/v0.50};
implementation

{v0.50}
procedure SetEnvVars;
var
  dir: string;
begin
  SetEnv('ExeDir', ExtractFilePath(Paramstr(0)));
  SetEnv('HomeDir', AddBackSlash(GetEnv('HOMEDRIVE') + GetEnv('HOMEPATH')));

  GetDir(0, dir);
  SetEnv('StartDir', AddBackSlash(dir));
{ StartDir =
  - if invoked from Start | Programs | Chromulan - than equals to ..\Plocha (Desktop),
  - if invoked from .lnk - equals to Chromulan ExeDir
  - if invoked through .ULF file - equals to directory of the .ULF file }
end;
{/v0.50}

var
  s: string;
initialization
  {v0.50}
  SetEnvVars;
  {/v0.50}
  {v0.29}
  s := ExtractFileDir(Paramstr(0));
  ChDir(s);
  {/v0.29
  ChDir(ExtractFilePath(Paramstr(0)));
  }
end.
