Here is my code
Expand|Select|Wrap|Line Numbers
- class ConfigFile
- {
- public void AddToConfig(string drive, string path)
- {
- System.Configuration.Configuration config =
- ConfigurationManager.OpenExeConfiguration(
- ConfigurationUserLevel.None);
- config.AppSettings.Settings.Add(drive, path);
- config.Save();
- }
The file is valid all along the program but is deleted automatically when the program closes.
The only way I found to prevent that is setting the file in read-only before the application closure. Not really clean though...
How can I manage to keep the file after closure?
Thanks ;)