1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-07-04 15:26:00 +02:00

Initial package management support

This commit is contained in:
Brian Fiete 2024-10-21 09:18:07 -04:00
parent 78138f5c5a
commit 4870c6fdd8
19 changed files with 2520 additions and 205 deletions

View file

@ -9,6 +9,7 @@ using Beefy;
using Beefy.gfx;
using Beefy.theme.dark;
using IDE.ui;
using System.Diagnostics;
namespace IDE
{
@ -128,6 +129,29 @@ namespace IDE
return true;
}
public static void SafeKill(int processId)
{
var beefConExe = scope $"{gApp.mInstallDir}/BeefCon.exe";
ProcessStartInfo procInfo = scope ProcessStartInfo();
procInfo.UseShellExecute = false;
procInfo.SetFileName(beefConExe);
procInfo.SetArguments(scope $"{processId} kill");
procInfo.ActivateWindow = false;
var process = scope SpawnedProcess();
process.Start(procInfo).IgnoreError();
}
public static void SafeKill(SpawnedProcess process)
{
if (process.WaitFor(0))
return;
SafeKill(process.ProcessId);
if (!process.WaitFor(2000))
process.Kill();
}
public static bool IsDirectoryEmpty(StringView dirPath)
{
for (let entry in Directory.Enumerate(scope String()..AppendF("{}/*.*", dirPath), .Directories | .Files))