Change "Start In" / "Working" Directory

I'm using Delphi 3 on Windows 95 clients running on an NT server.  Let's say the app in question is g:\appdir\app.exe

Most of the users don't have write access to the 'appdir' directory.  Therefore, when the app tries to execute SQL commands, it bombs out because it wants to write temporary files in 'appdir.'  It seems to want to create files like '_QSQL012.dbf'

To fix this, I have specified 'C:\' as the "Start In" directory on the desktop shortcuts - this ensures that the app write temporary files to a place where the user has write access.

Invariably, this gets messed up or bypassed and the app falls over.  Is there a way to avoid creating these temporary files or to change the "Start In" directory programmatically after the app has started running?

Thanks,
WKHays
LVL 4
wkhaysAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

okhomaCommented:
To change current directory, you may use SetCurrentDir function. Specify the temporary directory as current and all your users should have write access to it.

To get temporary directory use GetTempPath Windows API function.

0
kretzschmarCommented:
hi wkhays,

just place in your mainform-oncreate-event this line

session.privatedir := 'c:\';

be sure, that the unit dbtables is in the uses-clause.

meikl
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
nricoCommented:
Can't you just use:
  ChDir('C:\');
???
0
wkhaysAuthor Commented:
Thanks everyone.  Kretzschmar's answer was the quickest and easiest and was written with confidence like it would work. And it did!
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Delphi

From novice to tech pro — start learning today.