Solved

Finding a file (or the Install Directory that has the file)

Posted on 2008-10-09
3
210 Views
Last Modified: 2010-04-21
I need to programmatically replace a file installed by Firebird after its been installed. The file is aliases.conf.
Now, I could ask the user to "Navigate" to the Firebird install directory, but if there's a more professional way then I should do that...

One option is to find the install directory of Firebird - where would this information be registered - KEEPING IN MIND VISTA

Another option is to search for it in Program Files - but this is very silly - surely there's a better way.
0
Comment
Question by:rfwoolf
  • 2
3 Comments
 
LVL 36

Accepted Solution

by:
Geert Gruwez earned 500 total points
Comment Utility
Create your own install program
and ask your users to run that first
if they can run the Firebird, they sure can run your installer too

Normally install directories are put in the registry under
HKEY_LOCAL_MACHINE/Software/"Software Vendor"
Where "Software Vendor" is Firebird / Intrbase / Borland etc.
I dont have Firebird, only interbase
and for Interbase it's

HKEY_LOCAL_MACHINE/Software/Interbase Corp/Interbase/CurrentVersion
it's in the RootDirectory item

Put the procedure in your installer
If the file would be in use allready when your installer runs
you could use  MoveFileEx
BOOL MoveFileEx(

    LPCTSTR lpExistingFileName,      // address of name of the existing file  
    LPCTSTR lpNewFileName,      // address of new name for the file
    DWORD dwFlags       // flag to determine how to move file
   );      
 
with dwFlags set to
MOVEFILE_DELAY_UNTIL_REBOOT      
Windows NT only: The function does not move the file until the operating system is restarted. The system moves the file immediately after AUTOCHK is executed, but before creating any paging files. Consequently, this parameter enables the function to delete paging files from previous startups.
0
 
LVL 13

Author Comment

by:rfwoolf
Comment Utility
Interesting...  Thanks for that Geert - with the registry values - does this work on Vista too? (I guess I should do some Vista testing)
I did manage to find a crappy workaround - by installing a utility called Firebird Database Manager - it has a utility that can set up Aliases - and it somehow knows where the aliases.conf file is.
0
 
LVL 13

Author Closing Comment

by:rfwoolf
Comment Utility
Still would like to know how this works in Vista
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now