Use FolderBrowserDialog on Unix instead of FolderBrowserEx

This commit is contained in:
YoshiRulz 2019-10-06 19:54:45 +10:00
parent d9c42f44a1
commit 17ba5fa815
No known key found for this signature in database
GPG Key ID: C4DE31C245353FB7
1 changed files with 24 additions and 6 deletions

View File

@ -6,6 +6,7 @@ using System.Windows.Forms;
using BizHawk.Client.Common; using BizHawk.Client.Common;
using BizHawk.Client.EmuHawk.WinFormExtensions; using BizHawk.Client.EmuHawk.WinFormExtensions;
using BizHawk.Common;
namespace BizHawk.Client.EmuHawk namespace BizHawk.Client.EmuHawk
{ {
@ -218,15 +219,32 @@ namespace BizHawk.Client.EmuHawk
system = null; system = null;
} }
DialogResult result;
string selectedPath;
if (OSTailoredCode.CurrentOS == OSTailoredCode.DistinctOS.Windows)
{
var f = new FolderBrowserEx var f = new FolderBrowserEx
{ {
Description = $"Set the directory for {name}", Description = $"Set the directory for {name}",
SelectedPath = PathManager.MakeAbsolutePath(box.Text, system) SelectedPath = PathManager.MakeAbsolutePath(box.Text, system)
}; };
var result = f.ShowDialog(); result = f.ShowDialog();
selectedPath = f.SelectedPath;
}
else
{
// FolderBrowserEx doesn't work in Mono for obvious reasons
var f = new FolderBrowserDialog
{
Description = $"Set the directory for {name}",
SelectedPath = PathManager.MakeAbsolutePath(box.Text, system)
};
result = f.ShowDialog();
selectedPath = f.SelectedPath;
}
if (result == DialogResult.OK) if (result == DialogResult.OK)
{ {
box.Text = PathManager.TryMakeRelative(f.SelectedPath, system); box.Text = PathManager.TryMakeRelative(selectedPath, system);
} }
} }