Where to store ini files, log files for an application?

Where should I be storing any ini files and log files that my application creates and uses?  I've been storing them right in the program's directory under Program Files which I realize now is not optimal - but works until users start using Vista.

So, where should I be storing them so that it will work on Vista and other versions of Windows?  Should the program create a folder in this place or should I have the install program do it?
davemabe2000Asked:
Who is Participating?
 
b0lsc0ttConnect With a Mentor IT ManagerCommented:
davemabe2000,

You could have your program use the %APPDATA% environment variable to access the AppData folder that is in the User's folder (e.g. c:\Documents and Settings\User\Application Data\).  That variable should work in any OS Windows 2000 and after.  Create your own folder in that folder and store your INI files in it.

Let me know if you have any questions or need more information.

b0lsc0tt
0
 
Pretzel_JesusCommented:
Actually you never put in a path to the files it uses whatever folder they are currently in, vista or otherwise. So things like:

StreamReader sr = new StreamReader("settings.ini");

would read data right from the root folder, regardless of where it is. This works for any OS.
0
 
b0lsc0ttIT ManagerCommented:
I'm glad I could help.  I am curious about the B grade though.  Since you never posted a response it would seem my comment was all you needed for an answer.  If that is the case this is complete and should get an A grade.  Please let me know how this turned out and why the grade.  If a mistake was made or you have a question about what grades mean here then let me know.
Thanks for the fun question.
bol
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.