mirror of
https://github.com/wabbajack-tools/wabbajack.git
synced 2024-08-30 18:42:17 +00:00
38 lines
1.1 KiB
C#
38 lines
1.1 KiB
C#
using System;
|
|
using System.Runtime.InteropServices;
|
|
using Microsoft.CodeAnalysis;
|
|
using Wabbajack.Common;
|
|
using Wabbajack.Paths;
|
|
using Wabbajack.Paths.IO;
|
|
|
|
namespace Wabbajack.App.Utilities;
|
|
|
|
public static class OSUtil
|
|
{
|
|
public static void OpenWebsite(Uri uri)
|
|
{
|
|
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
|
|
{
|
|
var helper = new ProcessHelper()
|
|
{
|
|
Path = "cmd.exe".ToRelativePath().RelativeTo(KnownFolders.WindowsSystem32),
|
|
Arguments = new[] {"/C", $"rundll32 url.dll,FileProtocolHandler {uri}"}
|
|
};
|
|
helper.Start().FireAndForget();
|
|
}
|
|
|
|
}
|
|
|
|
public static void OpenFolder(AbsolutePath path)
|
|
{
|
|
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
|
|
{
|
|
var helper = new ProcessHelper()
|
|
{
|
|
Path = "explorer.exe".ToRelativePath().RelativeTo(KnownFolders.Windows),
|
|
Arguments = new object[] {path}
|
|
};
|
|
helper.Start().FireAndForget();
|
|
}
|
|
}
|
|
} |