I’m writing this off-topic post in hopes that it’ll save other folks the time/trouble that I just wasted trying to troubleshoot an installer that seemed to be installing old versions of files. Nothing was wrong with the installer, nothing was wrong with my eyes, nothing was wrong at all, except my memory. As a software developer, I had already learned about this pitfall, and just plain forgot.
Vista Pain In The Neck Rule #1: If you modify or create a program in the “program files” directory, or a program does it for you, Vista will play tricks on you.
- Editing a file yourself, even if you have administrator privleges
- Any program that writes a data file to the program files directory (unless it’s an installer).
- Any program that writes configuration or .ini files to the program files directory (unless that program was launched by an installer).
Here’s what I did:
I had modified a file myself, using TextPad or EmEdit (both are excellent text editors), in c:\program files\ClipMate7\Languages. The file was called “english.lng”. This was to test some changes for an upcoming maintenance release. The modified file contained a version string 7.2.05.165, so I could easily check it within the program, to see if the translation was up-to-date.
A few days later (today), I installed my shiny new version 7.2.06.166. Guess what? English.lng contained the 7.2.05.165 version. 🙁
I re-checked the installer and build scripts and directories. Everything was fine. As far as I could see, 7.2.06.166 was making it into the installer. I uninstalled, rebooted, re-installed, and still had the old file.
Then I remembered the whole UAC thing, and how Vista makes some sort of “shadow” copy. That’s what happens when Vista asks for special permission to continue with the “file save” or delete. Yes, yes, yes indeed. I found the old file lurking in:
I deleted it, and everything was fine.
How did this happen?
I was assuming that the installer would be able to clean up any such problems, but apparently, while the special UAC privlege for installers only allows them to install/delete files in the program files directory, it does NOT have provisions for reconciling newly-installed files with older files that are lurking in the VirtualStore directory. Even though the installer supplied a new version of english.lng, Vista showed me the old one.
Lessons Learned To Date:
- If a program file needs to write important data to its own directory, install it somewhere else. I have set up D:\Apps, for this purpose.
- If you are backing up a program that seems to store its data in its own directory, and you didn’t follow #1 above, don’t count on the backup actually having the right files.
- If you install a program and it offers to “run program now”? Don’t. Just let the installer quit, and then run the program yourself. Otherwise you’ll run the risk of the program running with elevated privleges, and creating data and configuration files that cannot be updated later.
- And today’s lesson: If you edit anything in the Program Files directory, you’re asking for trouble. Be sure to check the VirtualStore cache.
- The Virtual Store resides in: C:\Users\<userid>\AppData\Local\VirtualStore\Program Files\ClipMate7\Language\English.lng
References and helpful links: