File save updates

This commit is contained in:
BubbaGumpShrump 2024-12-04 22:41:56 -05:00
parent d74a14948d
commit 10e88866f5
6 changed files with 55 additions and 17 deletions

View file

@ -350,11 +350,20 @@ namespace AutoTrackR2
private void SaveButton_Click(object sender, RoutedEventArgs e)
{
// Get the directory of the running executable
string exeDirectory = Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location);
// Get the directory for the user's local application data
string appDataDirectory = Path.Combine(
Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData),
"AutoTrackR2"
);
// Combine the executable directory with the config file name
string configFilePath = Path.Combine(exeDirectory, "config.ini");
// Ensure the directory exists
if (!Directory.Exists(appDataDirectory))
{
Directory.CreateDirectory(appDataDirectory);
}
// Combine the app data directory with the config file name
string configFilePath = Path.Combine(appDataDirectory, "config.ini");
using (StreamWriter writer = new StreamWriter(configFilePath))
{