kill roblox players on upgrade no matter what

This commit is contained in:
bluepilledgreat 2024-12-28 15:59:43 +00:00
parent 534e3bbc0e
commit a55a0be6bb

View File

@ -691,21 +691,19 @@ namespace Bloxstrap
} }
} }
private void KillRunningRobloxInDirectory(string path) private static void KillRobloxPlayers()
{ {
const string LOG_IDENT = "Bootstrapper::KillRunningRobloxInDirectory"; const string LOG_IDENT = "Bootstrapper::KillRobloxPlayers";
List<Process> processes = new List<Process>(); List<Process> processes = new List<Process>();
processes.AddRange(Process.GetProcessesByName(IsStudioLaunch ? "RobloxStudioBeta" : "RobloxPlayerBeta")); processes.AddRange(Process.GetProcessesByName("RobloxPlayerBeta"));
processes.AddRange(Process.GetProcessesByName("RobloxCrashHandler")); processes.AddRange(Process.GetProcessesByName("RobloxCrashHandler")); // roblox studio doesnt depend on crash handler being open, so this should be fine
foreach (Process process in processes) foreach (Process process in processes)
{ {
try try
{ {
string? processPath = process.MainModule?.FileName; process.Kill();
if (processPath != null && processPath.StartsWith(path))
process.Kill();
} }
catch (Exception ex) catch (Exception ex)
{ {
@ -730,9 +728,11 @@ namespace Bloxstrap
_isInstalling = true; _isInstalling = true;
// make sure nothing is running from the latest version directory before deleting the whole directory // make sure nothing is running before continuing upgrade
KillRunningRobloxInDirectory(_latestVersionDirectory); if (!IsStudioLaunch) // TODO: wait for studio processes to close before updating to prevent data loss
KillRobloxPlayers();
// get a fully clean install
if (Directory.Exists(_latestVersionDirectory)) if (Directory.Exists(_latestVersionDirectory))
{ {
try try