Skip to content

Commit 6bf3506

Browse files
committed
Make sure the default directory of track and wx files are not version-specific.
1 parent db14917 commit 6bf3506

2 files changed

Lines changed: 7 additions & 9 deletions

File tree

src/QSP/UI/Forms/TracksForm.cs

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,12 @@
1919
using static QSP.RouteFinding.Tracks.AirwayNetwork;
2020
using static QSP.RouteFinding.Tracks.Common.Helpers;
2121
using static QSP.RouteFinding.Tracks.Interaction.StatusRecorder;
22-
using static QSP.Utilities.ExceptionHelpers;
2322
using static QSP.Utilities.LoggerInstance;
2423

2524
namespace QSP.UI.Forms
2625
{
2726
public partial class TracksForm
2827
{
29-
private static readonly string trackFileFolder = "Tracks";
3028
private static readonly string trackFileExtension = ".track";
3129

3230
private AirwayNetwork airwayNetwork;
@@ -336,11 +334,11 @@ private void saveBtn_Click(object sender, EventArgs e)
336334
return;
337335
}
338336

339-
IgnoreException(() => Directory.CreateDirectory(trackFileFolder));
337+
var myDoc = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
340338
var saveFileDialog = new SaveFileDialog();
341339

342340
saveFileDialog.Filter = GetFileDialogFilter();
343-
saveFileDialog.InitialDirectory = Path.GetFullPath(trackFileFolder);
341+
saveFileDialog.InitialDirectory = myDoc;
344342
saveFileDialog.RestoreDirectory = true;
345343

346344
if (saveFileDialog.ShowDialog() == DialogResult.OK)
@@ -350,7 +348,6 @@ private void saveBtn_Click(object sender, EventArgs e)
350348
try
351349
{
352350
File.Delete(file);
353-
Directory.CreateDirectory(trackFileFolder);
354351
TrackFiles.SaveToFile(msg, file);
355352
}
356353
catch (Exception ex)
@@ -364,9 +361,10 @@ private void saveBtn_Click(object sender, EventArgs e)
364361
private void importBtn_Click(object sender, EventArgs e)
365362
{
366363
var openFileDialog = new OpenFileDialog();
367-
364+
368365
openFileDialog.Filter = GetFileDialogFilter();
369-
openFileDialog.InitialDirectory = Path.GetFullPath(trackFileFolder);
366+
openFileDialog.InitialDirectory = Environment.GetFolderPath(
367+
Environment.SpecialFolder.MyDocuments);
370368
openFileDialog.RestoreDirectory = true;
371369

372370
if (openFileDialog.ShowDialog() == DialogResult.OK)

src/QSP/UI/Forms/WindDataForm.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,13 +91,13 @@ private void SaveFile(object sender, EventArgs e)
9191
{
9292
var sourceFile = WindManager.DownloadFilePath;
9393

94-
if (windAvailable == false)
94+
if (!windAvailable)
9595
{
9696
this.ShowWarning("No wind data has been downloaded or loaded from file.");
9797
return;
9898
}
9999

100-
if (File.Exists(sourceFile) == false)
100+
if (!File.Exists(sourceFile))
101101
{
102102
this.ShowWarning("The temporary wind data file was deleted. Unable to proceed.");
103103
return;

0 commit comments

Comments
 (0)