Solved

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

Posted on 2008-10-09
3
212 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 37

Accepted Solution

by:
Geert Gruwez earned 500 total points
ID: 22684831
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
ID: 22686196
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
ID: 31504907
Still would like to know how this works in Vista
0

Featured Post

Is Your AD Toolbox Looking More Like a Toybox?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

810 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