3
votes

I have a project group that contains a project I'm working on as well as some related component and packages. I prefer to keep the database links active during design-time.

I know how to write the code which would change the database file location, but in this case, I'm just using ".\data" instead, for various design-time reasons. Unfortunately, using a relative folder means that Delphi needs to be "pointing" to the same folder that the project is in.

I'd like to be able to force the folder location to a different root, without using the "Save As" feature. Does anyone happen to know where the Delphi IDE retrieves that info?

7

7 Answers

2
votes

I have some projects in delphi7, Delphi2009, Delphi2010 and DelphiXE4 and also my project are not stored in my document. I force the save/default like this:

Tools > Options > Environment Options > Default project

for Delphi 2010 => U:\Projects\Rad Studio 2010\Projects

1
votes

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.
0
votes

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)

0
votes

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.

0
votes

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.

0
votes

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

-1
votes

Tools -> Options -> Environment Options -> Environment Variables - BDSProjectsDir