diff --git a/src/QSP/UI/Forms/TracksForm.cs b/src/QSP/UI/Forms/TracksForm.cs index 00c3a04b..93bb9029 100644 --- a/src/QSP/UI/Forms/TracksForm.cs +++ b/src/QSP/UI/Forms/TracksForm.cs @@ -19,14 +19,12 @@ using static QSP.RouteFinding.Tracks.AirwayNetwork; using static QSP.RouteFinding.Tracks.Common.Helpers; using static QSP.RouteFinding.Tracks.Interaction.StatusRecorder; -using static QSP.Utilities.ExceptionHelpers; using static QSP.Utilities.LoggerInstance; namespace QSP.UI.Forms { public partial class TracksForm { - private static readonly string trackFileFolder = "Tracks"; private static readonly string trackFileExtension = ".track"; private AirwayNetwork airwayNetwork; @@ -336,11 +334,11 @@ private void saveBtn_Click(object sender, EventArgs e) return; } - IgnoreException(() => Directory.CreateDirectory(trackFileFolder)); + var myDoc = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments); var saveFileDialog = new SaveFileDialog(); saveFileDialog.Filter = GetFileDialogFilter(); - saveFileDialog.InitialDirectory = Path.GetFullPath(trackFileFolder); + saveFileDialog.InitialDirectory = myDoc; saveFileDialog.RestoreDirectory = true; if (saveFileDialog.ShowDialog() == DialogResult.OK) @@ -350,7 +348,6 @@ private void saveBtn_Click(object sender, EventArgs e) try { File.Delete(file); - Directory.CreateDirectory(trackFileFolder); TrackFiles.SaveToFile(msg, file); } catch (Exception ex) @@ -364,9 +361,10 @@ private void saveBtn_Click(object sender, EventArgs e) private void importBtn_Click(object sender, EventArgs e) { var openFileDialog = new OpenFileDialog(); - + openFileDialog.Filter = GetFileDialogFilter(); - openFileDialog.InitialDirectory = Path.GetFullPath(trackFileFolder); + openFileDialog.InitialDirectory = Environment.GetFolderPath( + Environment.SpecialFolder.MyDocuments); openFileDialog.RestoreDirectory = true; if (openFileDialog.ShowDialog() == DialogResult.OK) diff --git a/src/QSP/UI/Forms/WindDataForm.cs b/src/QSP/UI/Forms/WindDataForm.cs index 871867c8..a84d7c76 100644 --- a/src/QSP/UI/Forms/WindDataForm.cs +++ b/src/QSP/UI/Forms/WindDataForm.cs @@ -91,13 +91,13 @@ private void SaveFile(object sender, EventArgs e) { var sourceFile = WindManager.DownloadFilePath; - if (windAvailable == false) + if (!windAvailable) { this.ShowWarning("No wind data has been downloaded or loaded from file."); return; } - if (File.Exists(sourceFile) == false) + if (!File.Exists(sourceFile)) { this.ShowWarning("The temporary wind data file was deleted. Unable to proceed."); return;