[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 477
  • Last Modified:

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
0
wkhays
Asked:
wkhays
1 Solution
 
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
 
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

Featured Post

Learn to develop an Android App

Want to increase your earning potential in 2018? Pad your resume with app building experience. Learn how with this hands-on course.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now