Skip to content

Commit

Permalink
Make sure the default directory of track and wx files are not version…
Browse files Browse the repository at this point in the history
…-specific.
  • Loading branch information
JetStream96 committed Feb 17, 2017
1 parent db14917 commit 6bf3506
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
12 changes: 5 additions & 7 deletions src/QSP/UI/Forms/TracksForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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)
Expand All @@ -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)
Expand All @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions src/QSP/UI/Forms/WindDataForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 6bf3506

Please sign in to comment.