cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
CWoodman
Level 3

Database folder path in Registry?

If the user changes the path for the database folder during installation, is the new path saved in the registry? How can my application know where to find the database?
Labels (1)
0 Kudos
(5) Replies
Dan_Galender
Level 10

Property and directory settings are not automatically saved to the registry. You might want your installer to write the database location to the registry so that it would be available to the application.
0 Kudos
CWoodman
Level 3

Thanks, Dan. Yes, I would like the installer to save the database folder path in the registry, in a known location. How do I do that?
0 Kudos
Dan_Galender
Level 10

Before commenting, I guess I should have asked which project type you are using.

If Basic MSI, you would create a "Registry" entry and under the desired key create a Registry Value (with whatever Value Name you want to give it, "DatabaseFolder" maybe?) whose Value Data is "[DATABASEFOLDER]" where DATABASEFOLDER is the Directory Identifier of that location. If you're not familiar with creating registry values, look at the help topic "Creating Registry Values"

If you're using an InstallScript project, you would either use the functions RegDBSetDefaultRoot and RegDBSetKeyValueEx to create the value or create a registry set with the appropriate registry key, use a user defined variable in the form as the Value Data, and have a FeatureSetTarget function call set the value of to the value of the location where the database in being installed.
0 Kudos
CWoodman
Level 3

Thanks Dan. You're a life-saver!

It works great. The user can now select or create a folder for the database file during the installation, and my application can find the file when it runs.
I used to keep the database in the program folder, but this is a no-no with Vista.

(For the benefit of anyone else reading this topic, the Registry value should be [DATABASEDIR] not [DATABASEFOLDER]. Took me a few minutes to discover that.)

Thanks again,
Crawford
0 Kudos
Dan_Galender
Level 10

CWoodman wrote:
Thanks Dan. You're a life-saver!

It works great. The user can now select or create a folder for the database file during the installation, and my application can find the file when it runs.
I used to keep the database in the program folder, but this is a no-no with Vista.

(For the benefit of anyone else reading this topic, the Registry value should be [DATABASEDIR] not [DATABASEFOLDER]. Took me a few minutes to discover that.)

Thanks again,
Crawford

Crawford-

I was using "DATABASEFOLDER" as a placeholder to mean whatever directory identifier you were using as the destination for the database (that's why I said "Where DATABASEFOLDER is the Directory Identifier of that location") since I didn't know what identifier you were using.

I'm glad you got it working.
0 Kudos