Board index » delphi » Getting the directory for an alias

Getting the directory for an alias

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

---------------------------------------------------------------------------
University of Saskatchewan |    --------  __o  
Computational Sciences     |   -------  _`\<,_
Saskatoon, Saskatchewan    |  -------  (*)/ (*)
Canada                     | URL: http://www.cs.usask.ca/undergrads/mtt142
---------------------------------------------------------------------------

 

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

Re:Getting the directory for an alias


mtt...@alfresco.usask.ca (Michael Tan)  wrote

Quote
> 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.

Look for the TSession methods in the online help...

Michael
--

Michael Suedkamp                                      m...@suedkm.franken.de

Re:Getting the directory for an alias


Michael,

Get a copy of the freeware component TQBE by David Berneda. There is a
function in it that returns the directory of an alias.

Cheers,

Matthew

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

> ---------------------------------------------------------------------------
> University of Saskatchewan |    --------  __o
> Computational Sciences     |   -------  _`\<,_
> Saskatoon, Saskatchewan    |  -------  (*)/ (*)
> Canada                     | URL: http://www.cs.usask.ca/undergrads/mtt142
> ---------------------------------------------------------------------------

--

==================================================================
Matthew McDermott
McDermott Enterprises
matt...@valleynet.com
My Web Page: http://www.valleynet.com/~matthew
------------------------------------------------------------------
Director of Information Services & Adjunct Professor - Mathematics
The American College of Prehospital Medicine: http://www.acpm.edu/
==================================================================

Other Threads