Skip to content

Commit

Permalink
Merge branch 'v2_develop' of github.com:gui-cs/Terminal.Gui into v2_d…
Browse files Browse the repository at this point in the history
…evelop
  • Loading branch information
tig committed Dec 1, 2023
2 parents 7b9ea81 + 52e7466 commit f4e0f95
Showing 1 changed file with 8 additions and 16 deletions.
24 changes: 8 additions & 16 deletions Terminal.Gui/Application.cs
Original file line number Diff line number Diff line change
Expand Up @@ -158,22 +158,14 @@ internal static void InternalInit (Func<Toplevel> topLevelFactory, ConsoleDriver
ConfigurationManager.Load (true);
ConfigurationManager.Apply ();

if (Driver == null) {
var p = Environment.OSVersion.Platform;
if (_forceFakeConsole) {
// For Unit Testing only
Driver = new FakeDriver ();
} else if (UseSystemConsole) {
Driver = new NetDriver ();
} else if (p == PlatformID.Win32NT || p == PlatformID.Win32S || p == PlatformID.Win32Windows) {
Driver = new WindowsDriver ();
} else {
Driver = new CursesDriver ();
}
if (Driver == null) {
throw new InvalidOperationException ("Init could not determine the ConsoleDriver to use.");
}
}
Driver ??= Environment.OSVersion.Platform switch {
_ when _forceFakeConsole => new FakeDriver (), // for unit testing only
_ when UseSystemConsole => new NetDriver (),
PlatformID.Win32NT or PlatformID.Win32S or PlatformID.Win32Windows => new WindowsDriver (),
_ => new CursesDriver (),
};

if (Driver == null) throw new InvalidOperationException ("Init could not determine the ConsoleDriver to use.");

try {
MainLoop = Driver.Init ();
Expand Down

0 comments on commit f4e0f95

Please sign in to comment.