4 Commits
Author SHA1 Message Date
Claude 15ba3995a5 quote args in relaunch_as_admin per CommandLineToArgvW
The previous implementation joined std::env::args() with single spaces,
which silently broke any argument containing whitespace, double quotes,
or trailing backslashes — most importantly manifest paths under
'C:\Program Files' or 'C:\Users\<name with space>'. After elevation
the relaunched process saw a different argv than the original.

quote_command_line_arg follows the standard MSVCRT / CommandLineToArgvW
encoding: quote on space/tab/quote/empty, escape embedded quotes with a
preceding backslash, and double any run of backslashes that would
otherwise be consumed by a following quote (including the closing one).

Tests cover the canonical edge cases plus a round-trip that re-parses
each encoded form with a reference argv parser to confirm fidelity.
2026-04-28 21:48:02 +00:00
Claude 65c415a59a document optional Linux cross-build path
Wine runs the test binary cleanly when targeting x86_64-pc-windows-gnu,
so wire that target's runner to wine in .cargo/config.toml. The default
windows-msvc build is unaffected.

README gains a 'Linux Cross-Build (Optional)' section with the dotnet
10 / mingw-w64 / wine prerequisites and the EnableWindowsTargeting=true
recipe needed to cross-build the net8.0-windows C# UI from Linux.
2026-04-28 17:02:38 +00:00
Claude 3adb61b751 drop unused PathResolver fields
program_files_x86 and windows_dir were stored but never read after
construction; only their string forms via admin_roots are used.
Compute them as locals in PathResolver::new instead, silencing the
dead_code warning without expanding the public surface.
2026-04-28 16:48:34 +00:00
Claude d72250eb73 resolve admin-required roots via SHGetKnownFolderPath
Replace the hardcoded "c:\\program files" / "c:\\windows" prefix
heuristic with a PathResolver::requires_admin method that matches
against runtime-resolved FOLDERID_ProgramFilesX64,
FOLDERID_ProgramFilesX86, and FOLDERID_Windows. Honors the MVP
"no hardcoded paths" rule, catches Program Files (x86) explicitly,
and works on non-C: Windows installs.

Match logic uses path-component boundaries so "C:\\Program Files
Custom" no longer false-positives against "C:\\Program Files".

Adds unit tests for the new method via a #[cfg(test)] constructor
that lets us seed roots without invoking Win32.
2026-04-28 16:39:12 +00:00