OpenHelper.cs 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. using Ryujinx.Common.Logging;
  2. using System;
  3. using System.Diagnostics;
  4. namespace Ryujinx.Ui.Common.Helper
  5. {
  6. public static class OpenHelper
  7. {
  8. public static void OpenFolder(string path)
  9. {
  10. Process.Start(new ProcessStartInfo
  11. {
  12. FileName = path,
  13. UseShellExecute = true,
  14. Verb = "open"
  15. });
  16. }
  17. public static void OpenUrl(string url)
  18. {
  19. if (OperatingSystem.IsWindows())
  20. {
  21. Process.Start(new ProcessStartInfo("cmd", $"/c start {url.Replace("&", "^&")}"));
  22. }
  23. else if (OperatingSystem.IsLinux())
  24. {
  25. Process.Start("xdg-open", url);
  26. }
  27. else if (OperatingSystem.IsMacOS())
  28. {
  29. Process.Start("open", url);
  30. }
  31. else
  32. {
  33. Logger.Notice.Print(LogClass.Application, $"Cannot open url \"{url}\" on this platform!");
  34. }
  35. }
  36. }
  37. }