mirror of
https://github.com/bloxstraplabs/bloxstrap.git
synced 2025-04-17 02:31:28 -07:00
Fix potential bug in install checker
UB would occur if installer.CheckInstallLocation() failed when attempting to change the install location
This commit is contained in:
parent
62064117b6
commit
356155c75b
@ -198,6 +198,26 @@ namespace Bloxstrap
|
||||
}
|
||||
}
|
||||
|
||||
if (fixInstallLocation && installLocation is not null)
|
||||
{
|
||||
var installer = new Installer
|
||||
{
|
||||
InstallLocation = installLocation,
|
||||
IsImplicitInstall = true
|
||||
};
|
||||
|
||||
if (installer.CheckInstallLocation())
|
||||
{
|
||||
Logger.WriteLine(LOG_IDENT, $"Changing install location to '{installLocation}'");
|
||||
installer.DoInstall();
|
||||
}
|
||||
else
|
||||
{
|
||||
// force reinstall
|
||||
installLocation = null;
|
||||
}
|
||||
}
|
||||
|
||||
if (installLocation is null)
|
||||
{
|
||||
Logger.Initialize(true);
|
||||
@ -205,21 +225,6 @@ namespace Bloxstrap
|
||||
}
|
||||
else
|
||||
{
|
||||
if (fixInstallLocation)
|
||||
{
|
||||
var installer = new Installer
|
||||
{
|
||||
InstallLocation = installLocation,
|
||||
IsImplicitInstall = true
|
||||
};
|
||||
|
||||
if (installer.CheckInstallLocation())
|
||||
{
|
||||
Logger.WriteLine(LOG_IDENT, $"Changing install location to '{installLocation}'");
|
||||
installer.DoInstall();
|
||||
}
|
||||
}
|
||||
|
||||
Paths.Initialize(installLocation);
|
||||
|
||||
// ensure executable is in the install directory
|
||||
@ -246,10 +251,8 @@ namespace Bloxstrap
|
||||
|
||||
Locale.Set(Settings.Prop.Locale);
|
||||
|
||||
#if !DEBUG
|
||||
if (!LaunchSettings.BypassUpdateCheck)
|
||||
Installer.HandleUpgrade();
|
||||
#endif
|
||||
|
||||
LaunchHandler.ProcessLaunchArgs();
|
||||
}
|
||||
|
@ -28,7 +28,11 @@ namespace Bloxstrap
|
||||
|
||||
public LaunchFlag StudioFlag { get; } = new("studio");
|
||||
|
||||
#if DEBUG
|
||||
public bool BypassUpdateCheck => true;
|
||||
#else
|
||||
public bool BypassUpdateCheck => UninstallFlag.Active || WatcherFlag.Active;
|
||||
#endif
|
||||
|
||||
public LaunchMode RobloxLaunchMode { get; set; } = LaunchMode.None;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user