Files
NebulaLauncher/Nebula.Launcher/Utils/ExplorerUtils.cs
2025-12-11 21:47:54 +03:00

33 lines
838 B
C#

using System;
using System.Diagnostics;
using System.Runtime.InteropServices;
namespace Nebula.Launcher.Utils;
public static class ExplorerUtils
{
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);
}
}