views:

27

answers:

2

Is there a web site (or something else) that has information on folders and their hierarchy where various programs and applications are installed?

Please let me explain. I am writing an application that (part of what it does) references certain files installed by other application. To be able to determine the file paths for these folders I have to download and install each application seperatly on my development pc, search for the file I want, and then write its path in my application.

This method is very time consuming and, frankly, boring, as it requires downloading and installing each application (some of them in excess of 600MB) and then locating the required file just to be able to "know" its path.

So, I was wondering if there is something that could speed things up. like, for example, a website that would have such information. I tried each of the applications own website for information but no dice.

Any help from you will be much appreciated. Many thanks

A: 

I know this isn't especially helpful, but to answer your question directly, I highly doubt that such a website exists, except for certain very common programs like MS Office or any of the major operating systems itself.

I have to say, though, hard-coding the paths in your program seems like a rather bad idea. What if someone using your program has one of these dependencies installed in a non-standard path? Normally anything your application would need to access should be installed in some sort of system folder whose path you can get dynamically from the runtime environment. (At least I know it works this way on Linux, I'm not sure to exactly what extent it's true on Windows)

David Zaslavsky
Your logic is correct. However, it doesn't apply in my case. The file i'm trying to access is an xml file and not a runtime dependency. furthermore, to make life easier for the user, my program is only asking for the installation folder of the required application/applications (just in case they are not installed in the default folder). from there I want to access my desired file. I could ask the user to point to the file directly and save myself the headache. However, I just wanted to make things a little bit easier on the user. and by the way, many thanks for your response.
mazrabul
A: 

If you're using Windows Installer, I would use a combination of the various search elements you have available. (AppSearch, RegLocator, etc.)

Here's an example using WiX code, this particular example first looks in the App Paths registry location to find the details for winword.exe, secondly it ensures that the version number is at least 11 (Office 2003).

<Property Id="WORDEXE" Secure="yes">
    <RegistrySearch Id="RegSearch_WORDEXE" Root="HKLM" Key="SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\Winword.exe" Type="file">
        <FileSearch Name="WINWORD.EXE" MinVersion="11.0.0.0" />
    </RegistrySearch>
</Property>

As long as all the applications you're searching for are using the App Paths key to expose themselves to the system then you should be able to work backwards from that and not even need to prompt the user. (This registry section is the reason you can just enter winword from the "Run" dialog even though it's not in the path and can't be run from a command prompt window.)

sascha
many thanks for the suggestion. I require the paths at runtime and not at install. However your suggetion pointed me towards searching the registry for the required application and from there get the installation path. from there I can search for the file I want. The idea seems simple but the implementation is not. A lot or resources on the net suggest searching the uninstall subkeys in the regisistry but this is not very helpful because a lot of installed applications do not have values stored there. i'm still tinkering with the idea though...
mazrabul