Skip to content

Commit

Permalink
search in unixroot first for the cfg file, then in the exe dir. creat…
Browse files Browse the repository at this point in the history
…e the log file in the LOGFILES env dir, if available, else in the exe dir
  • Loading branch information
SilvanScherrer committed Sep 20, 2017
1 parent 0bd130a commit 2b8d98e
Showing 1 changed file with 20 additions and 2 deletions.
22 changes: 20 additions & 2 deletions lxLite_src/lxLite_Objects.pas
Expand Up @@ -940,6 +940,7 @@ function tMyCmdLineParser.ParmHandler;
var
I,J,K : Longint;
S : string;
logPath : string;

Function isEnabled : boolean;
begin
Expand Down Expand Up @@ -1139,7 +1140,12 @@ procedure SetTreshold(var Treshold : longint);
else SetRC(I)
else parmHandler := I;
if (opt.Log <> 0) and (opt.logFileName = '')
then opt.logFileName := sourcePath + logFname;
then begin
logPath := GetEnv('LOGFILES');
if logPath = '' then logPath := sourcePath;
if not (logPath[length(logPath)] in ['/', '\']) then logPath := logPath + '\';
opt.logFileName := logPath + logFname;
end;
end;
'M' : if length(ParmStr) > 1
then case upCase(ParmStr[2]) of
Expand Down Expand Up @@ -1356,8 +1362,20 @@ procedure LoadConfig;
iPos : pCollection;
pSC : pStringCollection;
S : string;
cfgPath : string;
unixroot: string;

begin
S := sourcePath + cfgFname;
{$ifdef OS2}
unixroot := GetEnv('UNIXROOT');
{$else}
unixroot := '';
{$endif}
if unixroot <> '' then begin
cfgPath := unixroot + '\etc\lxLite\';
if not FileExist(cfgPath + cfgFname) then cfgPath := sourcePath;
end else cfgPath := sourcePath;
S := cfgPath + cfgFname;
Assign(T, S); Reset(T);
if ioResult <> 0 then Stop(msgCannotLoadCFG, S);
New(iPos, Create(4, 4));
Expand Down

0 comments on commit 2b8d98e

Please sign in to comment.