views:

259

answers:

1

Hi All, The application I am working with writes to the User\Application Data folder on XP and the AppData\Roaming folder on Vista. On one of the Vista machines the AppData\Roaming folder is not present. As a result some of the features of the application are not functioning. Have any of you encountered such a scenario before? I am not sure what to do in this case. Can I create the AppData\Roaming folder?

Thanks jbsp72

A: 

If you're hardcoding those paths, you should be using environment variables instead.

On the machine in question, open a command prompt (WinKey+R>cmd>Enter) and enter echo %appdata% and press Enter. It should return the application data path for the current user.

...oh, and to use environment variables, replace, for example c:\Program Files\MyProgram\data with %programfiles%\MyProgram\data

There are many lists of these available, on of which is at http://vistaonwindows.com/environment_variables.html

Jay
I am not hard coding the paths. I am reading them from the registry( If I am not mistaken even SHGetFolder() does that ). The path I am getting is AppData\Roaming but the folder is absent on the system.
jbsp72
...but the registry is telling your application that's the folder to use? Are there other users on that system, and do they have AppData\Roaming under their `<root>:\Users` directories? How about the default user?
Jay
Does Vista have the alternate junctions, like Win 7, under `<root>:\Users\<user>\Application Data`? If so, can you get to, say, `<root>:\Users\<user>\Application Data\Microsoft`?
Jay
Yes, the registry is telling me the AppData folder is at AppData\Roaming but that folder is not present on the system? I don't have the machine with me one of the users reported this. I will get back to you regarding other users having AppData\Roaming
jbsp72
Hmmm... now I'm curious about the user's report and whether this whole folder thing might be a red herring. How did he or she check for the folder? By default, it is hidden in Explorer. I would expect a lot more problems on the user's machine if the expected appdata folder really isn't there.
Jay
Kudos.. you are right! The guy who brought this to my notice didn't bother to check if the folder is hidden. The problem is something else entirely. Thanks
jbsp72