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", "Roblox", Paths.Application);
ProtocolHandler.Register("roblox-player", "Roblox", Paths.Application); ProtocolHandler.Register("roblox-player", "Roblox", Paths.Application);
#if STUDIO_FEATURES
ProtocolHandler.Register("roblox-studio", "Roblox", Paths.Application); ProtocolHandler.Register("roblox-studio", "Roblox", Paths.Application);
ProtocolHandler.Register("roblox-studio-auth", "Roblox", Paths.Application); ProtocolHandler.Register("roblox-studio-auth", "Roblox", Paths.Application);
ProtocolHandler.RegisterRobloxPlace(Paths.Application); ProtocolHandler.RegisterRobloxPlace(Paths.Application);
ProtocolHandler.RegisterExtension(".rbxl"); ProtocolHandler.RegisterExtension(".rbxl");
ProtocolHandler.RegisterExtension(".rbxlx"); ProtocolHandler.RegisterExtension(".rbxlx");
#endif
if (Environment.ProcessPath is not null && Environment.ProcessPath != Paths.Application) 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, "", Path.Combine(Paths.StartMenu, "Play Roblox.lnk"));
Utility.Shortcut.Create(Paths.Application, "-menu", Path.Combine(Paths.StartMenu, $"{App.ProjectName} Menu.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")); Utility.Shortcut.Create(Paths.Application, "-ide", Path.Combine(Paths.StartMenu, $"Roblox Studio ({App.ProjectName}).lnk"));
#endif
if (App.Settings.Prop.CreateDesktopIcon) if (App.Settings.Prop.CreateDesktopIcon)
{ {
@ -686,11 +690,13 @@ namespace Bloxstrap
process.Close(); process.Close();
} }
#if STUDIO_FEATURES
foreach (Process process in Process.GetProcessesByName(App.RobloxStudioAppName)) foreach (Process process in Process.GetProcessesByName(App.RobloxStudioAppName))
{ {
process.Kill(); process.Kill();
process.Close(); process.Close();
} }
#endif
} }
catch (Exception ex) catch (Exception ex)
{ {
@ -725,6 +731,7 @@ namespace Bloxstrap
ProtocolHandler.Register("roblox-player", "Roblox", bootstrapperLocation); ProtocolHandler.Register("roblox-player", "Roblox", bootstrapperLocation);
} }
#if STUDIO_FEATURES
using RegistryKey? studioBootstrapperKey = Registry.CurrentUser.OpenSubKey(@"Software\Microsoft\Windows\CurrentVersion\Uninstall\roblox-studio"); using RegistryKey? studioBootstrapperKey = Registry.CurrentUser.OpenSubKey(@"Software\Microsoft\Windows\CurrentVersion\Uninstall\roblox-studio");
if (studioBootstrapperKey is null) if (studioBootstrapperKey is null)
{ {
@ -745,6 +752,7 @@ namespace Bloxstrap
ProtocolHandler.RegisterRobloxPlace(studioLocation); ProtocolHandler.RegisterRobloxPlace(studioLocation);
} }
#endif
// if the folder we're installed to does not end with "Bloxstrap", we're installed to a user-selected folder // 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) // 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)
@ -948,7 +956,11 @@ namespace Bloxstrap
// delete any old version folders // delete any old version folders
// we only do this if roblox isnt running just in case an update happened // we only do this if roblox isnt running just in case an update happened
// while they were launching a second instance or something idk // while they were launching a second instance or something idk
#if STUDIO_FEATURES
if (!Process.GetProcessesByName(App.RobloxPlayerAppName).Any() && !Process.GetProcessesByName(App.RobloxStudioAppName).Any()) 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()) foreach (DirectoryInfo dir in new DirectoryInfo(Paths.Versions).GetDirectories())
{ {

View File

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