Board index » delphi » tables on "current directory"

tables on "current directory"

I am using D5.01 c/s with BDE 5.11.

I have a small project with 2 tables which reside on the exe directory. How
do I tell Delphi/BDE that the tablesare  on the current directory without
bothering with database or alias.
I tried to leave database propery of the Ttable blank, it worked for
sometime then one day it started to say the table doesnt exisit on
c:\delphi..... which I dont know where it took this name from. I could not
slove it until I wrote the full path in the database property. This is not
good for me because I need this program to work on any directory it is
copied upon without any further settings.

Is the only way to solve this is Table1.database := pathFrom(paramStr(0)); ?

Thanks
Sraya

 

Re:tables on "current directory"


On Sun, 4 Nov 2001 13:09:02 +0200, "Sraya Malkiel" <sr...@malkiel.com>
wrote:

Quote
>Is the only way to solve this is Table1.database := pathFrom(paramStr(0)); ?

In the Object Inspector you can use '.\'

I don't know if this also works also at runtime, but in any case I
would not rely on it, as I guess it depends on the current working
directory, which may be changed anytime. What's wrong with extracting
the path from the command line? If the tables are in the same
directory as the application, that ensures they shall always be found.

Manuel Algora
m...@encomix.es

Re:tables on "current directory"


Add the following line to your main form's OnCreate event handler so that it
executes before you open any tables..

ChDir(ExtractFilePath(Application.ExeName));

This should set the current directory to the directory that contains the
EXE.

--
Bill
(TeamB cannot answer questions received via email)

Re:tables on "current directory"


Bill - Thanks
I new I saw this extract function but could not recall the word 'extract' to
look for in the help index.
Sraya
"Bill Todd (TeamB)" <bill.nos...@dbginc.com> wrote in message
news:3be54e9b$1_2@dnews...
Quote
> Add the following line to your main form's OnCreate event handler so that
it
> executes before you open any tables..

> ChDir(ExtractFilePath(Application.ExeName));

> This should set the current directory to the directory that contains the
> EXE.

> --
> Bill
> (TeamB cannot answer questions received via email)

Other Threads