Files

33 lines
838 B
C#
Raw Permalink Normal View History

2025-06-19 21:12:42 +03:00
using System;
using System.Diagnostics;
using System.Runtime.InteropServices;
2025-12-11 21:47:54 +03:00
namespace Nebula.Launcher.Utils;
2025-06-19 21:12:42 +03:00
2025-12-11 21:47:54 +03:00
public static class ExplorerUtils
2025-06-19 21:12:42 +03:00
{
public static void OpenFolder(string path)
{
string command;
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
command = "explorer.exe";
else if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
command = "xdg-open";
else if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
command = "open";
else
throw new PlatformNotSupportedException("Unsupported OS platform");
var startInfo = new ProcessStartInfo
{
FileName = command,
Arguments = path,
UseShellExecute = false
};
Process.Start(startInfo);
}
}