mirror of
https://github.com/bloxstraplabs/bloxstrap.git
synced 2025-04-21 10:01:27 -07:00
kill roblox instances that are running in latest version directory
This commit is contained in:
parent
a91742fe51
commit
8b8d49e784
@ -691,6 +691,32 @@ namespace Bloxstrap
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void KillRunningRobloxInDirectory(string path)
|
||||||
|
{
|
||||||
|
const string LOG_IDENT = "Bootstrapper::KillRunningRobloxInDirectory";
|
||||||
|
|
||||||
|
List<Process> processes = new List<Process>();
|
||||||
|
processes.AddRange(Process.GetProcessesByName(IsStudioLaunch ? "RobloxStudioBeta" : "RobloxPlayerBeta"));
|
||||||
|
processes.AddRange(Process.GetProcessesByName("RobloxCrashHandler"));
|
||||||
|
|
||||||
|
foreach (Process process in processes)
|
||||||
|
{
|
||||||
|
string? processPath = process.MainModule?.FileName;
|
||||||
|
if (processPath != null && processPath.StartsWith(path))
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
process.Kill();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
App.Logger.WriteLine(LOG_IDENT, $"Failed to close process {process.Id} at {processPath}");
|
||||||
|
App.Logger.WriteException(LOG_IDENT, ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private async Task UpgradeRoblox()
|
private async Task UpgradeRoblox()
|
||||||
{
|
{
|
||||||
const string LOG_IDENT = "Bootstrapper::UpgradeRoblox";
|
const string LOG_IDENT = "Bootstrapper::UpgradeRoblox";
|
||||||
@ -706,6 +732,9 @@ namespace Bloxstrap
|
|||||||
|
|
||||||
_isInstalling = true;
|
_isInstalling = true;
|
||||||
|
|
||||||
|
// make sure nothing is running from the latest version directory before deleting the whole directory
|
||||||
|
KillRunningRobloxInDirectory(_latestVersionDirectory);
|
||||||
|
|
||||||
if (Directory.Exists(_latestVersionDirectory))
|
if (Directory.Exists(_latestVersionDirectory))
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
Loading…
Reference in New Issue
Block a user