Skip to content

Commit

Permalink
Environment.ExpandEnvironmentVariables (#70)
Browse files Browse the repository at this point in the history
  • Loading branch information
jdahlblom authored Feb 3, 2024
1 parent 3fbbfda commit a8f1530
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/client/DCSInsight/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ public partial class MainWindow : Window, IErrorListener, IConnectionListener, I
public MainWindow()
{
InitializeComponent();
Settings.Default.DCSBiosJSONLocation = Environment.ExpandEnvironmentVariables(Settings.Default.DCSBiosJSONLocation);
Settings.Default.Save();
ICEventHandler.AttachErrorListener(this);
ICEventHandler.AttachConnectionListener(this);
ICEventHandler.AttachDataListener(this);
Expand Down Expand Up @@ -72,7 +74,7 @@ private void MainWindow_OnLoaded(object sender, RoutedEventArgs e)
Top = Settings.Default.MainWindowTop.CompareTo(-1) == 0 ? Top : Settings.Default.MainWindowTop;
Left = Settings.Default.MainWindowLeft.CompareTo(-1) == 0 ? Left : Settings.Default.MainWindowLeft;

ButtonLuaWindow.Visibility = Directory.Exists(Environment.ExpandEnvironmentVariables(Settings.Default.DCSBiosJSONLocation)) ? Visibility.Visible : Visibility.Collapsed;
ButtonLuaWindow.Visibility = Directory.Exists(Settings.Default.DCSBiosJSONLocation) ? Visibility.Visible : Visibility.Collapsed;
_formLoaded = true;
}
catch (Exception ex)
Expand Down
2 changes: 1 addition & 1 deletion src/client/DCSInsight/Windows/SettingsWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ private void ButtonOk_OnClick(object sender, RoutedEventArgs e)

if (DCSBIOSChanged)
{
Settings.Default.DCSBiosJSONLocation = TextBoxDcsBiosJSONLocation.Text;
Settings.Default.DCSBiosJSONLocation = Environment.ExpandEnvironmentVariables(TextBoxDcsBiosJSONLocation.Text);
Settings.Default.Save();
}
DialogResult = true;
Expand Down

0 comments on commit a8f1530

Please sign in to comment.