Now checks current directory before mysticbbs environment variable.

This commit is contained in:
mysticbbs 2012-08-24 13:19:43 -04:00
parent c64481a7ed
commit e86ed5cc6a
1 changed files with 14 additions and 9 deletions

View File

@ -81,18 +81,23 @@ Var
FileConfig : TBufFile; FileConfig : TBufFile;
DatLoc : String; DatLoc : String;
Begin Begin
FileConfig := TBufFile.Create(SizeOf(RecConfig));
If Not FileConfig.Open('mystic.dat', fmOpen, fmReadWrite + fmDenyNone, SizeOf(RecConfig)) Then Begin
DatLoc := GetEnv('mysticbbs'); DatLoc := GetEnv('mysticbbs');
If DatLoc <> '' Then DatLoc := DirSlash(DatLoc); If DatLoc <> '' Then DatLoc := DirSlash(DatLoc);
FileConfig := TBufFile.Create(SizeOf(RecConfig));
If Not FileConfig.Open(DatLoc + 'mystic.dat', fmOpen, fmReadWrite + fmDenyNone, SizeOf(RecConfig)) Then Begin If Not FileConfig.Open(DatLoc + 'mystic.dat', fmOpen, fmReadWrite + fmDenyNone, SizeOf(RecConfig)) Then Begin
WriteLn; WriteLn;
WriteLn ('ERROR: Unable to read MYSTIC.DAT. This file must exist in the same'); WriteLn ('ERROR: Unable to read MYSTIC.DAT. This file must exist in the same');
WriteLn ('directory as MIS'); WriteLn ('directory as MIS');
FileConfig.Free;
Halt (1); Halt (1);
End; End;
End;
FileConfig.Read(bbsConfig); FileConfig.Read(bbsConfig);
FileConfig.Free; FileConfig.Free;