Re:Getting the directory for an alias
Quote
Michael Tan wrote:
> Relatively new to the real guts with Delphi, and I need some help.
> I am trying to get the directory associated with an alias. How does one
> do this? I don't have any access to any good manuals out there besides
> the help file.
> Any suggestions will be greatful.
> Thanks
> --
> Michael Tan
> michael....@usask.ca
The following function will check for the existence of a .DB
table. In the process it actually extracts the path of the
Alias.
function TblExists(tbl: TTable): Boolean;
var
sFileName: string;
tDatabases,
dbParams: TStringList;
i, j: integer;
begin
result := False;
try
if tbl = nil then
Exit;
if tbl.TableName = '' then
Exit;
dbParams := TStringList.Create;
dbParams.Add(' ');
sFileName := tbl.TableName;
if tbl.DatabaseName <> '' then
begin
Session.GetAliasParams(tbl.DatabaseName, dbParams);
if dbParams <> nil then
for j := 0 to dbParams.count - 1 do
if (UpperCase(cleft(dbParams[j], 4)) = 'PATH') then
sFileName := substr(dbParams[j], pos('=',
dbParams[j]) + 1, length(dbParams[j])) +
'\' + tbl.TableName + '.DB';
end;
result := FileExists(sFileName);
except
end;
dbParams.Free
end;
--
Hope that helps
Brahm
--------------------------- EEEEEEE DDDDD SSSS
Brahm van Niekerk - EE DD DD SS
Elgin Data Systems - EE DD DD SS
"See the future" - EEEE DD D SS
P.O. Box 140,Elgin, 7180 - EE DD DD SS
Republic of South Africa - EE DD DD SS
--------------------------- EEEEEEE DDDD SSSS