Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Launcher.Core/SetupGuide.cs
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ static async Task RemovePartialClone(string target)
/// the client tables from client.db and live.ps1 extracts only what they still read.</summary>
public static bool ExtractsForServers(string checkout)
{
try { return Regex.IsMatch(File.ReadAllText(Path.Combine(checkout, "scripts", "dev", "extract-data.ps1")), @"\[switch\]\$Servers", RegexOptions.IgnoreCase); }
try { return Regex.IsMatch(File.ReadAllText(Path.Combine(checkout, "scripts", "dev", "extract-data.ps1")), @"\[switch\]\$Servers\b", RegexOptions.IgnoreCase); }
catch (Exception e) when (e is IOException or UnauthorizedAccessException) { return false; }
}

Expand Down
18 changes: 18 additions & 0 deletions tests/Launcher.Checks/SetupChecks.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ public static async Task RunAsync(string fixture, Action<bool, string> check)
await LinksAsync(root, check);
await SequenceAsync(check);
await CloneAsync(root, check);
ExtractScope(root, check);
check(Prerequisites.HasSdk("8.0.427 [C:\\sdk]\n10.0.403 [C:\\sdk]\n") && !Prerequisites.HasSdk("9.0.320 [C:\\sdk]\n"), "only a .NET 10 SDK counts");
check(PythonLookup.VersionOf("Python 3.12.4") == new Version(3, 12, 4) && PythonLookup.VersionOf("Python 3.9.0b1") == new Version(3, 9, 0)
&& PythonLookup.VersionOf("Python was not found; run without arguments to install from the Microsoft Store") is null,
Expand Down Expand Up @@ -52,6 +53,23 @@ static string Client(string root, string name, params (string File, int Bytes)[]
return folder;
}

/// <summary>Setup extracts only what the servers read when the checkout's extract-data.ps1 takes -Servers.</summary>
static void ExtractScope(string root, Action<bool, string> check)
{
string Checkout(string name, string param)
{
string folder = Path.Combine(root, name);
Directory.CreateDirectory(Path.Combine(folder, "scripts", "dev"));
File.WriteAllText(Path.Combine(folder, "scripts", "dev", "extract-data.ps1"), $"# extracts game data\r\nparam({param})\r\n");
return folder;
}
check(SetupSequence.ExtractsForServers(Checkout("split", "[switch]$Force, [string[]]$Only = @(), [switch]$List, [string]$ExportManifest, [switch]$Servers")),
"a checkout whose extract-data.ps1 takes -Servers extracts only what the servers read");
check(!SetupSequence.ExtractsForServers(Checkout("before-split", "[switch]$Force, [string[]]$Only = @(), [switch]$List, [string]$ServersList")),
"a checkout from before the split, or a longer name that starts with Servers, extracts everything");
check(!SetupSequence.ExtractsForServers(Path.Combine(root, "no-checkout")), "no extract-data.ps1 extracts everything");
}

static void Classify(string root, Action<bool, string> check)
{
string standalone = Client(root, "standalone", ("Content.ggpk", 10), ("PathOfExile.exe", 10));
Expand Down
Loading