Build: toggling of studio functionality

This commit is contained in:
pizzaboxer 2024-06-11 19:06:42 +01:00
parent 4a366adad9
commit a3033474b8
No known key found for this signature in database
GPG Key ID: 59D4A1DBAD0F2BA8
2 changed files with 16 additions and 2 deletions

View File

@ -517,12 +517,14 @@ namespace Bloxstrap
ProtocolHandler.Register("roblox", "Roblox", Paths.Application);
ProtocolHandler.Register("roblox-player", "Roblox", Paths.Application);
#if STUDIO_FEATURES
ProtocolHandler.Register("roblox-studio", "Roblox", Paths.Application);
ProtocolHandler.Register("roblox-studio-auth", "Roblox", Paths.Application);
ProtocolHandler.RegisterRobloxPlace(Paths.Application);
ProtocolHandler.RegisterExtension(".rbxl");
ProtocolHandler.RegisterExtension(".rbxlx");
#endif
if (Environment.ProcessPath is not null && Environment.ProcessPath != Paths.Application)
{
@ -556,7 +558,9 @@ namespace Bloxstrap
Utility.Shortcut.Create(Paths.Application, "", Path.Combine(Paths.StartMenu, "Play Roblox.lnk"));
Utility.Shortcut.Create(Paths.Application, "-menu", Path.Combine(Paths.StartMenu, $"{App.ProjectName} Menu.lnk"));
#if STUDIO_FEATURES
Utility.Shortcut.Create(Paths.Application, "-ide", Path.Combine(Paths.StartMenu, $"Roblox Studio ({App.ProjectName}).lnk"));
#endif
if (App.Settings.Prop.CreateDesktopIcon)
{
@ -686,11 +690,13 @@ namespace Bloxstrap
process.Close();
}
#if STUDIO_FEATURES
foreach (Process process in Process.GetProcessesByName(App.RobloxStudioAppName))
{
process.Kill();
process.Close();
}
#endif
}
catch (Exception ex)
{
@ -725,6 +731,7 @@ namespace Bloxstrap
ProtocolHandler.Register("roblox-player", "Roblox", bootstrapperLocation);
}
#if STUDIO_FEATURES
using RegistryKey? studioBootstrapperKey = Registry.CurrentUser.OpenSubKey(@"Software\Microsoft\Windows\CurrentVersion\Uninstall\roblox-studio");
if (studioBootstrapperKey is null)
{
@ -745,6 +752,7 @@ namespace Bloxstrap
ProtocolHandler.RegisterRobloxPlace(studioLocation);
}
#endif
// if the folder we're installed to does not end with "Bloxstrap", we're installed to a user-selected folder
// in which case, chances are they chose to install to somewhere they didn't really mean to (prior to the added warning in 2.4.0)
@ -821,7 +829,7 @@ namespace Bloxstrap
Dialog?.ShowSuccess(Resources.Strings.Bootstrapper_SuccessfullyUninstalled, callback);
}
#endregion
#endregion
#region Roblox Install
private async Task InstallLatestVersion()
@ -948,7 +956,11 @@ namespace Bloxstrap
// delete any old version folders
// we only do this if roblox isnt running just in case an update happened
// while they were launching a second instance or something idk
#if STUDIO_FEATURES
if (!Process.GetProcessesByName(App.RobloxPlayerAppName).Any() && !Process.GetProcessesByName(App.RobloxStudioAppName).Any())
#else
if (!Process.GetProcessesByName(App.RobloxPlayerAppName).Any())
#endif
{
foreach (DirectoryInfo dir in new DirectoryInfo(Paths.Versions).GetDirectories())
{
@ -1510,6 +1522,6 @@ namespace Bloxstrap
string extractionPath = Path.Combine(_versionFolder, _packageDirectories[package.Name], entry.FullName);
entry.ExtractToFile(extractionPath, true);
}
#endregion
#endregion
}
}

View File

@ -91,6 +91,7 @@ namespace Bloxstrap
RobloxLaunchMode = LaunchMode.Player;
}
#if STUDIO_FEATURES
else if (arg.StartsWith("roblox-studio:"))
{
RobloxLaunchArgs = ProtocolHandler.ParseUri(arg);
@ -121,6 +122,7 @@ namespace Bloxstrap
RobloxLaunchArgs = $"-task EditFile -localPlaceFile \"{pathArg}\"";
}
}
#endif
}
private void Parse()