R/Ryujinx/Ui/Helper/OpenHelper.cs
Ac_K a9cb31e75f
gui: Refactoring Part 1 (#1859)
* gui: Refactoring Part 1

* Fix ProfileDialog.glade path

* Fix Application.Quit assert

* Fix TitleUpdateWindow parent

* Fix TitleUpdate selected item

* Remove extra line in TitleUpdateWindow

* Fix empty assign of Enum.TryParse

* Add Patrons list in the About Window

* update about error messages
2021-01-08 09:14:13 +01:00

39 lines
No EOL
1.1 KiB
C#

using Ryujinx.Common.Logging;
using System.Diagnostics;
using System.Runtime.InteropServices;
namespace Ryujinx.Ui.Helper
{
static class OpenHelper
{
public static void OpenFolder(string path)
{
Process.Start(new ProcessStartInfo
{
FileName = path,
UseShellExecute = true,
Verb = "open"
});
}
public static void OpenUrl(string url)
{
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
{
Process.Start(new ProcessStartInfo("cmd", $"/c start {url.Replace("&", "^&")}"));
}
else if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
{
Process.Start("xdg-open", url);
}
else if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
{
Process.Start("open", url);
}
else
{
Logger.Notice.Print(LogClass.Application, $"Cannot open url \"{url}\" on this platform!");
}
}
}
}