chore(unity): 固定Unity CLI Loop本地包并移除UnitySkills依赖
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
using System.ComponentModel;
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace io.github.hatayama.uLoopMCP
|
||||
{
|
||||
public static class ProcessStartHelper
|
||||
{
|
||||
// NativeErrorCode 2 (ERROR_FILE_NOT_FOUND) and 3 (ERROR_PATH_NOT_FOUND) on Windows
|
||||
// map to ENOENT on POSIX; other Win32Exception causes (e.g. permission denied) should
|
||||
// propagate so callers fail fast instead of silently treating them as "not installed".
|
||||
private const int ERROR_FILE_NOT_FOUND = 2;
|
||||
private const int ERROR_PATH_NOT_FOUND = 3;
|
||||
|
||||
public static Process TryStart(ProcessStartInfo startInfo)
|
||||
{
|
||||
try
|
||||
{
|
||||
return Process.Start(startInfo);
|
||||
}
|
||||
catch (Win32Exception ex) when (ex.NativeErrorCode == ERROR_FILE_NOT_FOUND
|
||||
|| ex.NativeErrorCode == ERROR_PATH_NOT_FOUND)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user