Solved

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

Posted on 2008-10-09
3
215 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

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…
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…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

733 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