2020-09-01 05:09:42 -04:00
|
|
|
|
using Ryujinx.Common.Logging;
|
|
|
|
|
using System.Diagnostics;
|
|
|
|
|
using System.Runtime.InteropServices;
|
|
|
|
|
|
2021-01-08 03:14:13 -05:00
|
|
|
|
namespace Ryujinx.Ui.Helper
|
2020-09-01 05:09:42 -04:00
|
|
|
|
{
|
2021-01-08 03:14:13 -05:00
|
|
|
|
static class OpenHelper
|
2020-09-01 05:09:42 -04:00
|
|
|
|
{
|
2021-01-08 03:14:13 -05:00
|
|
|
|
public static void OpenFolder(string path)
|
|
|
|
|
{
|
|
|
|
|
Process.Start(new ProcessStartInfo
|
|
|
|
|
{
|
|
|
|
|
FileName = path,
|
|
|
|
|
UseShellExecute = true,
|
|
|
|
|
Verb = "open"
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
2020-09-01 05:09:42 -04:00
|
|
|
|
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!");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2021-01-08 03:14:13 -05:00
|
|
|
|
}
|