Solved

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

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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

856 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