2020-09-01 02:09:42 -07:00
|
|
|
|
using Ryujinx.Common.Logging;
|
2021-12-04 15:02:30 -08:00
|
|
|
|
using System;
|
2020-09-01 02:09:42 -07:00
|
|
|
|
using System.Diagnostics;
|
|
|
|
|
|
2022-05-15 04:30:15 -07:00
|
|
|
|
namespace Ryujinx.Ui.Common.Helper
|
2020-09-01 02:09:42 -07:00
|
|
|
|
{
|
2022-05-15 04:30:15 -07:00
|
|
|
|
public static class OpenHelper
|
2020-09-01 02:09:42 -07:00
|
|
|
|
{
|
2021-01-08 00:14:13 -08:00
|
|
|
|
public static void OpenFolder(string path)
|
|
|
|
|
{
|
|
|
|
|
Process.Start(new ProcessStartInfo
|
|
|
|
|
{
|
|
|
|
|
FileName = path,
|
|
|
|
|
UseShellExecute = true,
|
|
|
|
|
Verb = "open"
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
2020-09-01 02:09:42 -07:00
|
|
|
|
public static void OpenUrl(string url)
|
|
|
|
|
{
|
2021-12-04 15:02:30 -08:00
|
|
|
|
if (OperatingSystem.IsWindows())
|
2020-09-01 02:09:42 -07:00
|
|
|
|
{
|
|
|
|
|
Process.Start(new ProcessStartInfo("cmd", $"/c start {url.Replace("&", "^&")}"));
|
|
|
|
|
}
|
2021-12-04 15:02:30 -08:00
|
|
|
|
else if (OperatingSystem.IsLinux())
|
2020-09-01 02:09:42 -07:00
|
|
|
|
{
|
|
|
|
|
Process.Start("xdg-open", url);
|
|
|
|
|
}
|
2021-12-04 15:02:30 -08:00
|
|
|
|
else if (OperatingSystem.IsMacOS())
|
2020-09-01 02:09:42 -07:00
|
|
|
|
{
|
|
|
|
|
Process.Start("open", url);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
Logger.Notice.Print(LogClass.Application, $"Cannot open url \"{url}\" on this platform!");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2021-01-08 00:14:13 -08:00
|
|
|
|
}
|