Home > Vista > Vista and Special Folders

Vista and Special Folders

December 13, 2007

Way back in January I posted about using Windows Special Folders for storing application data. Today, while setting up a new Vista PC for my boss, I came across a great reason why this approach is a good idea.

I was installing one of our applications that stores a serialized file in the special folder LocalApplicationData. My boss has a ton of configuration information in his current install of this application, and I thought it would be a good thing to simply copy his current configuration over to his new machine. Hey, anything that makes his life easier makes my life easier!

So I began by copying his binary file to a network location for later retrieval. I then went to his new Vista PC … and couldn’t find the correct folder path. I looked all through the Vista folder structure, which only served to frustrate me. On XP, the directory path was something like C:\Documents and Settings\%user%\Local Applications\Application Data\. In Vista C:\Documents and Settings\%user%\ has been replaced with simply C:\Users\%user%\.

But I couldn’t find anything there like what I needed, nor anywhere else for that matter, so I wrote a quick little Console application to output the Special Folder path. Sure enough, it turns out to be C:\Users\%user%\AppData\Local. I went back to Windows Explorer and could not see the folder. Of course, that is when I realized that the folder was hidden.

No problem, I thought, I just need to alter the view to show hidden files and folders, something I’ve done a hundred times on Windows machines. So I right-click in the folder, select “Customize This Folder”, and … nothing. No option to show hidden items. Hmmm, they must have moved it. I right-click and try “Properties”. Still no joy.

Finally, in the tool bar, under the “Organize” drop down, I find an option for “Folder and Search Options”. This window has a “View” tab that reveals the old View options I am used to seeing. Finally! I checked the option for “Show hidden files and folders” (and made a couple of other changes while I was in there) and now I can finally find the correct path. I hate relearning old tricks.

So back to the lesson: I found the correct path, which had been created by my application, retrieved the binary file from the Network store, and replaced the new one created by the application install. I open the application and Viola! – all my boss’s configurations are happily restored.

So, take advantage of the Special Folder system. The folder structures between XP and Vista are quite different, but using this approach made reinstalling my old .NET 1.1 application a happy affair.

Advertisements
Categories: Vista
%d bloggers like this: