I have a project group that contains a project I'm working on as well as some related component / packages. I prefer to have the database links active at design time, and though I know how to write the code to change database files location, I'm just using ".\data" for that in this case, for a few different reasons, mostly design-time related. Being a relative folder location, though, means Delphi needs to be "pointing" to the same folder as the project is in.

I'd like to be able to force that folder location, w/o using "Save As." Does anyone know where the Delphi IDE stores that info?

+1  A: 

I am not sure I completely understand your question.

  • If you are referring to the folder the IDE has as the current folder, then you can just change the shortcut that launches Delphi to set the current directory where ever you want it to be.
Jim McKeeth

You can change the location the project compliers and saves the dcu/unit/exe to in Project/Options under the Directories/Conditionals is that what you are looking for?

I bevile there is also some settings for the DBE in the Tools menu, but I dont have them install at the moment (or i cant find them)


I'd say you should just hard-code the full path to the database. Not pretty, but it will always work. There are tools, like GExperts, that will ensure your database components are set to inactive when you save them, and that way you can be sure to set them correctly on the live computer at runtime.

It would be nice to use relative paths, but that would be a function of the component and not the application really.


Do NOT use a path relative to .exe path. That will get you into trouble with Windows XP in limited access mode, as well as with Windows Vista.

Do you need one database for all users? Use a path relative to All Users\Application Data directory.

Do you need separate databases per user? Use a path relative to user's private User\Application Data directory.

Do you need multiple databases per user? Use a path relative to user's My Documents directory.

Use any of the above as default, but add registry keys that allow you to override the settings.

Lars Fosdal

I believe it gets that info from Tools -> Options -> Environment Options -> Environment Variables. Try to play with those (Add override).