CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 9 of 9
  1. #1
    Join Date
    Sep 2006
    Posts
    199

    Recommended location for local config files for an app

    Where should my app store local configuration files (like xml files) to retain screen position, etc.?

    I just moved my development box from XP to Vista and apparently writing files to some folder inside "c:\program files" is verboten.

    So where is the (now) recommended place to store these files?

    thanks.

    Using .Net 3.5 SP1 and WPF

  2. #2
    Join Date
    Jun 2004
    Location
    Kashmir, India
    Posts
    6,808

    Re: Recommended location for local config files for an app

    That seems to be an issue with the permissions on your system. Usually the config files will be retained in the same folder as your project. Don't you have write permissions on the folder where your project is located?

  3. #3
    Join Date
    Nov 2007
    Location
    .NET 3.5 / VS2008 Developer
    Posts
    624

    Re: Recommended location for local config files for an app

    a number of applications (Microsoft apps and Google apps) use the C:\Documents and Settings\[user]\Local Settings\Application Data". The "Local Settings" folder is a hidden folder, I believe, so it's a good place to put config files.

  4. #4
    Join Date
    Oct 2008
    Location
    Cologne, Germany
    Posts
    756

    Re: Recommended location for local config files for an app

    yet another solution: IsolatedStorage
    http://www.codeguru.com/csharp/cshar...icle.php/c4225
    win7 x86, VS 2008 & 2010, C++/CLI, C#, .NET 3.5 & 4.0, VB.NET, VBA... WPF is comming

    remeber to give feedback you think my response deserves recognition? perhaps you may want to click the Rate this post link/button and add to my reputation

    private lessons are not an option so please don't ask for help in private, I won't replay

    if you use Opera and you'd like to have the tab-button functionality for the texteditor take a look at my Opera Tab-UserScirpt; and if you know how to stop firefox from jumping to the next control when you hit tab let me know

  5. #5
    Join Date
    Sep 2006
    Posts
    199

    Re: Recommended location for local config files for an app

    Is there a C# function to get a filepath to this folder (since it can't be known until installation). And if so, how does it work during development/debugging since the app isn't installed in its final location at that point? (this is for the C:\Documents and Settings\[user]\Local Settings\Application Data method)
    Last edited by purpleflash; July 5th, 2009 at 10:26 AM. Reason: clarification

  6. #6
    Join Date
    Oct 2008
    Location
    Cologne, Germany
    Posts
    756

    Re: Recommended location for local config files for an app

    maybe this will help
    Code:
    Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData);
    http://msdn.microsoft.com/en-us/libr...ialfolder.aspx
    Last edited by memeloo; July 5th, 2009 at 10:53 AM.
    win7 x86, VS 2008 & 2010, C++/CLI, C#, .NET 3.5 & 4.0, VB.NET, VBA... WPF is comming

    remeber to give feedback you think my response deserves recognition? perhaps you may want to click the Rate this post link/button and add to my reputation

    private lessons are not an option so please don't ask for help in private, I won't replay

    if you use Opera and you'd like to have the tab-button functionality for the texteditor take a look at my Opera Tab-UserScirpt; and if you know how to stop firefox from jumping to the next control when you hit tab let me know

  7. #7
    Join Date
    Sep 2006
    Posts
    199

    Re: Recommended location for local config files for an app

    What happens during debugging... where will that location be since the app isn't installed yet. thanks.

  8. #8
    Join Date
    Oct 2008
    Location
    Cologne, Germany
    Posts
    756

    Re: Recommended location for local config files for an app

    it's "hidden" here
    Code:
    C:\Users\USER\AppData\Local\BASE_NAMESPACE_NAME
    **edit: I've forgotten to add that this is the path on Vista
    Last edited by memeloo; July 6th, 2009 at 08:44 AM.
    win7 x86, VS 2008 & 2010, C++/CLI, C#, .NET 3.5 & 4.0, VB.NET, VBA... WPF is comming

    remeber to give feedback you think my response deserves recognition? perhaps you may want to click the Rate this post link/button and add to my reputation

    private lessons are not an option so please don't ask for help in private, I won't replay

    if you use Opera and you'd like to have the tab-button functionality for the texteditor take a look at my Opera Tab-UserScirpt; and if you know how to stop firefox from jumping to the next control when you hit tab let me know

  9. #9
    Join Date
    Sep 2006
    Posts
    199

    Re: Recommended location for local config files for an app

    Ok. I think I will go this route.

    Next question- I have two .xml files I need to store there, however I need to allow the users to copy their own custom .xml files to this location. Is it possible (within ClickOnce deployment) to copy skeleton versions of these .xml files to the app's local folder, but have the install leave these files alone if they are already there (customized by the user)?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured