fix(setup): handle install-folder services, startup entries, shared shortcuts and data
- Windows services whose program lies in the install folder (Titano.Server --install-service) are found in the registry and, through the Service Control Manager, stopped before files are replaced (they join the "programs running" prompt), started again after an upgrade that stopped them, deleted when an upgrade drops their program and on uninstall. An unelevated setup runs that step in an elevated copy (/SERVICES=...). - The Server component installs for all users only (manifest allUsersOnly): choosing it moves a new install to Program Files and disables "Just me" with the reason; a per-user install cannot take it. - Uninstall removes every HKCU Run value that starts a program in the folder (the Uploader's "Start with Windows"). - A shortcut that already starts an existing program elsewhere is neither retargeted nor logged, and a logged shortcut is deleted only while it still starts a program of this folder, so the two products no longer remove each other's "Titano Uploader" shortcuts. - "Remove my data" lists and deletes only the data of this product's programs that no other installed Titano product uses (the desktop app and the Uploader share %LOCALAPPDATA%\Titano and its logs folder). - The .titano file type is named in setup's language (Setup.FileType.*). Setup tests run in Titano.App.Tests on Windows CI. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012iLMBNwBE2GnphAsu4cjaC
This commit is contained in:
32 files changed
+1175
-88
No files matched your search
@@ -6,18 +6,20 @@ namespace Titano.Tools.Commands;
|
||||
/// <summary>
|
||||
/// <c>pack-installer --setup Titano.Setup.exe --product Titano --version 1.2.3 --component Id=folder … --out file</c>:
|
||||
/// appends a TPK1 payload (BRIEF §18) to the setup program. Known component ids carry their display name, default
|
||||
/// selection, shortcuts and file types; unknown ids are packed as plain, preselected components.
|
||||
/// selection, shortcuts and file types; unknown ids are packed as plain, preselected components. The Server
|
||||
/// installs only for all users: it is registered as a LocalSystem service, which must run from Program Files.
|
||||
/// </summary>
|
||||
internal sealed class PackInstallerCommand : ICommand
|
||||
{
|
||||
private sealed record KnownComponent(string DisplayName, bool DefaultSelected, string Program, bool Desktop, PayloadAssociation? Association);
|
||||
private sealed record KnownComponent(string DisplayName, bool DefaultSelected, string Program, bool Desktop, PayloadAssociation? Association, bool AllUsersOnly = false);
|
||||
|
||||
/// <remarks>The file type's description is the English fallback; setup writes it in its own language (<c>Setup.FileType.*</c>).</remarks>
|
||||
private static readonly Dictionary<string, KnownComponent> Known = new(StringComparer.OrdinalIgnoreCase)
|
||||
{
|
||||
["Titano"] = new("Titano", true, "Titano.exe", Desktop: true,
|
||||
new PayloadAssociation { Component = "Titano", Extension = ".titano", ProgId = "Titano.Project", Description = "Titano project", Target = "Titano.exe" }),
|
||||
["Uploader"] = new("Titano Uploader", true, "Titano.Uploader.exe", Desktop: true, null),
|
||||
["Server"] = new("Titano Server", false, "Titano.Server.exe", Desktop: false, null),
|
||||
["Server"] = new("Titano Server", false, "Titano.Server.exe", Desktop: false, null, AllUsersOnly: true),
|
||||
};
|
||||
|
||||
public string Name => "pack-installer";
|
||||
@@ -49,7 +51,7 @@ internal sealed class PackInstallerCommand : ICommand
|
||||
components.Add(new PayloadComponentSource(id, id, true, folder));
|
||||
continue;
|
||||
}
|
||||
components.Add(new PayloadComponentSource(id, known.DisplayName, known.DefaultSelected, folder));
|
||||
components.Add(new PayloadComponentSource(id, known.DisplayName, known.DefaultSelected, folder, known.AllUsersOnly));
|
||||
if (!File.Exists(Path.Combine(folder, known.Program)))
|
||||
{
|
||||
Console.Error.WriteLine($"warning: {id} has no {known.Program}; no shortcut or file type registered.");
|
||||
|
||||
Reference in new issue
Block a user