"""After a build that stopped, Triforce Setup's build page offers Copy report beside Show details (setup/Guard.cs Report;
no Setup is started, no log of this PC is read and the clipboard is not touched).
A player with a failed build had to open the details, select and copy them, and find setup.log in the install folder; what
they pasted carried their Windows account's name in nearly every path.
Compiles Guard.cs with tests/setup_report_test.cs and runs it: the last 200 lines of each log; the account's folder read as
%USERPROFILE% however a tool printed it (either slash, doubled backslashes, other case, its short name), while another
account whose name only begins the same, and a name with characters a pattern would read otherwise, are left as they are;
the report put together with nothing of the name in it. Reads the source for the window's side: the link is on the build
page and shown only after a build that stopped by itself, and what it copies is made from the page's details, setup.log
and the account's folder.
python -I -B tests/test_setup_report.py
"""
import re
import sys
from pathlib import Path
RUN_ALL_SKIP = {"linux": "Triforce Setup is a Windows program (.NET Framework 4.8)"}
sys.path.insert(0, str(Path(__file__).resolve().parent))
import setup_cs # noqa: E402
def check_source():
xaml = setup_cs.source("setup/Main.xaml")
page = xaml[xaml.index('")[0], 'Visibility="Collapsed"', "setup/Main.xaml: Copy report shows before any build stopped")
shell = setup_cs.source("setup/Shell.cs")
for needle, why in (
('CopyReport = Part