[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

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

Posted on 2008-11-05
3
Medium Priority
?
320 Views
Last Modified: 2008-12-11
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?
0
Comment
Question by:davemabe2000
  • 2
3 Comments
 
LVL 54

Accepted Solution

by:
b0lsc0tt earned 1500 total points
ID: 22891767
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
 

Expert Comment

by:Pretzel_Jesus
ID: 22891935
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
 
LVL 54

Expert Comment

by:b0lsc0tt
ID: 23149874
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

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you have done a reformat of your hard drive and proceeded to do a successful Windows XP installation, you may notice that a choice between two operating systems when you start up the machine. Here is how to get rid of this: Click Start Clic…
For both online and offline retail, the cross-channel business is the most recent pattern in the B2C trade space.
The Task Scheduler is a powerful tool that is built into Windows. It allows you to schedule tasks (actions) on a recurring basis, such as hourly, daily, weekly, monthly, at log on, at startup, on idle, etc. This video Micro Tutorial is a brief intro…
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…
Suggested Courses
Course of the Month18 days, 9 hours left to enroll

825 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question