aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.Ui.Common/Helper/OpenHelper.cs
blob: eaaa739246a2de5b3d4a407cdae28993034d9868 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
using Ryujinx.Common.Logging;
using System;
using System.Diagnostics;

namespace Ryujinx.Ui.Common.Helper
{
    public 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 (OperatingSystem.IsWindows())
            {
                Process.Start(new ProcessStartInfo("cmd", $"/c start {url.Replace("&", "^&")}"));
            }
            else if (OperatingSystem.IsLinux())
            {
                Process.Start("xdg-open", url);
            }
            else if (OperatingSystem.IsMacOS())
            {
                Process.Start("open", url);
            }
            else
            {
                Logger.Notice.Print(LogClass.Application, $"Cannot open url \"{url}\" on this platform!");
            }
        }
    }
}