Home | Blog | Software | Reviews and Features | Forum | Help | Donate | About us
topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • December 03, 2016, 08:01:48 PM
  • Proudly celebrating 10 years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Author Topic: Vista/Windows 7 install locations. Discuss.  (Read 1859 times)

daddydave

  • Supporting Member
  • Joined in 2008
  • **
  • Posts: 822
    • View Profile
    • Donate to Member
Vista/Windows 7 install locations. Discuss.
« on: May 26, 2010, 10:48:20 AM »
OK, people these days like their applications to be portable, and store their configuration in the same folder as the exe.

But Windows Vista and 7 really don't like it if you have to save your configuration file back into any subfolder of Program Files, so normally you as a developer would just put in in %APPDATA%\program name, right?

All right, so when you are writing the installer (not every user wants to bother with zips), it seems you have a couple of choices:

1. Ask the user if (s)he wants a portable install or a regular install. If it is a portable install, store the settings in the same folder as the program. Otherwise, store the settings in the registry and %APPDATA%\program name

2. Just make the default install location C:\Tools\program name and store the settings in the same folder always. Keep things simple. Make it easy to copy to USB stick later if needed.

Either way, of course, the user can change the default install folder. I'm probably the only one with a folder called C:\Tools so an attentive user may want to change it to C:\Utilities or something. Or back to C:\Program Files which breaks my plan.

I've been leaning toward #2 for a while. Microsoft doesn't try to stop anyone from saving to C:\Tools so that bit of security by obscurity is bypassed. When I as a user install a program, if it's a zip file, C:\Tools is where it goes. If it's some random program and I suspect that the program uses an INI file instead of the registry, C:\Tools is where it goes.

This is learned behavior. Before Vista, I was conditioned to put everything in Program Files, even if the app came to me as a zip file. In Vista, if I tried this, the first time I needed to save settings back to an INI file inside a subfolder of C:\Program Files, it didn't even give a UAC prompt, it simply did one of these two things:

a. It would simply fail.

b. It would appear to work, but it was actually saving to file to a redirected location within my user profile. So I and seemingly the programs themselves had trouble finding the program settings because we had to look in both the real Program Files folder and the virtual Program Files folder within my user profile.

So what I used to do in Vista was
1. Make a note of the folder name the installer created
2. Uninstall the program
3. Make sure the program folder was still there and set the permissions so that I had permissions to write to it
4. Reinstall the program

This seems to be less of an issue with Windows 7, which is around the time I decided to install more programs in C:\Tools. If I put a file in one of the forbidden locations, I usually get a UAC prompt and it lets me continue. I haven't thought much about folder redirection since moving on to Windows 7, so either it has become more transparent, or it's because this is around the time I started installing things to the Tools folder more frequently. I'm curious now, I'll see if I can find the redirected folders on my main box (which runs Windows 7) when I get a chance. It's strange that I don't remember ever even seeing them in Windows 7.

(And yes, I know UAC and folder redirection can be turned off, but I never felt good about doing that.)

This is my most rambling post ever; basically I want to know what you folks think about install locations, should the installer ask the user if he wants it to be portable, or just install it somewhere like C:\Tools where it won't matter. Or is there a third (or fourth, or fifth) way?
If bad things happen to other people, it's karma. If bad things happen to me, it's kismat!
« Last Edit: May 26, 2010, 11:05:51 AM by daddydave »

mouser

  • First Author
  • Administrator
  • Joined in 2005
  • *****
  • Posts: 36,406
    • View Profile
    • Mouser's Software Zone on DonationCoder.com
    • Read more about this member.
    • Donate to Member
Re: Vista/Windows 7 install locations. Discuss.
« Reply #1 on: May 26, 2010, 11:37:16 AM »
Here is what i do, for better or worse:

  • Make my programs so that the installer does not have to install any files that won't always go into the Program Files\Application\ directory (ie the program creates its settings file on first use).  The installer then defaults to installing in the Program Files\Application\ directory, and there is no need to decide anything important at install time.
  • When the program runs, it does 2 checks to see where it should store the configuration/settings files:  First, it looks for a configdir.ini file in the installation directory, which the user can edit to manually specify where the settings file should be stored -- this is how a user forces the application to run portably.  Second,  if there are is no such configdir.ini file or if it doesn't specify anything, then the program checks the operating system -- if its Vista or later, it uses AppData\Application\ directory for settings file, if it's xp or earlier it uses the installation directory.  Always defaulting to AppData would be fine too i think.

« Last Edit: May 26, 2010, 11:40:08 AM by mouser »

MilesAhead

  • Supporting Member
  • Joined in 2009
  • **
  • Posts: 7,277
    • View Profile
    • Miles Ahead Software
    • Donate to Member
Re: Vista/Windows 7 install locations. Discuss.
« Reply #2 on: May 26, 2010, 12:57:44 PM »
My small utilities I have create their .ini and data files in the .exe file folder wherever the user unzips it. Not that it comes up that often, but I've found from my own experience that putting these small apps under a folder in the path works well. I use C:\Utils. If it's an .exe that's not going to create any files, I'll just dump it in the folder since the folder is in the path.  If it's going to create an .ini file and/or data files, I'll put it in a folder inside C:\Utils.

Here's the bonus I didn't plan for.  When doing a Custom Install as in putting Windows Seven on a system that has Vista as example, the Windows Seven installer gathers up all the stuff under Program Files and sticks it in Windows.old.  It doesn't bother with C:\Utils.  I set the path, all my command line apps in C:\Utils still run.  I drag a shortcut and I can use apps in a folder under C:\Utils.  As soon as I upgrade I have a bunch of my favorite small utilities already on the system ready to use.  Just have to make a shortcut.

I should probably stick a suggestion in the Readme files but there's already so much in there. Plus how often do people do Custom Installs?  But that's the install I use most often.



Of course this only applies to "hotkey" type apps that don't use the Registry.  The old Delphi stuff still has Inno Setup installers.  The hotkey apps are small enough each user can install his own copy. No real need to "install for all users" with them.

daddydave

  • Supporting Member
  • Joined in 2008
  • **
  • Posts: 822
    • View Profile
    • Donate to Member
Re: Vista/Windows 7 install locations. Discuss.
« Reply #3 on: June 10, 2010, 08:07:39 PM »
Nice flowchart from the Stickies help file.
Screenshot - 6_10_2010 , 9_06_42 PM.png
If bad things happen to other people, it's karma. If bad things happen to me, it's kismat!