This repository has been archived on 2025-06-05. You can view files and clone it, but cannot push or open issues or pull requests.
2025-05-02 06:46:59 -07:00

41 lines
1.4 KiB
C#

using System.Diagnostics;
using RobloxLegacy.Utilities;
namespace RobloxLegacy;
public class Installer
{
private static readonly string InstallPath = Path.Combine(
Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData),
"Roblox", "Versions"
);
private static void SetShortcuts(string filePath)
{
// create a shortcut on the desktop
Shortcut.Create(
"Launch Roblox",
filePath,
"Updater and patcher for roblox on legacy operating systems",
Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory)
);
// create a shortcut in the start menu
Shortcut.Create(
"Roblox Legacy",
filePath,
"Updater and patcher for roblox on legacy operating systems",
Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.StartMenu), "Programs")
);
}
public static void DeployBootstrapper()
{
var bootstrapperPath = Process.GetCurrentProcess()?.MainModule?.FileName ?? throw new Exception("Could not find bootstrapper");
var installPath = Path.Combine(InstallPath, "RobloxLegacy.exe");
if(bootstrapperPath == installPath) // already installed
return;
File.Copy(bootstrapperPath, installPath, true);
SetShortcuts(installPath);
}
}