ui: Mark the active mod profile #50
No reviewers
Labels
No labels
Kind/Breaking
Kind/Bug
Kind/Documentation
Kind/Enhancement
Kind/Feature
Kind/Security
Kind/Testing
Priority
Critical
Priority
High
Priority
Low
Priority
Medium
Reviewed
Confirmed
Reviewed
Duplicate
Reviewed
Invalid
Reviewed
Won't Fix
Status
Abandoned
Status
Blocked
Status
Need More Info
blocked
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
s1d3sw1ped/SwipedModSwitcher!50
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "ash/active-profile"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Closes #49
Why
The window showed one button per profile and nothing told you which one the Game Mod Directory currently points at.
What changed
switcher.Active(profilesDir, modsPath)reads (never writes) the mods path:Lstat,Readlink,Statonly. It reports Linked (with the profile), RealFolder, Missing, Outside (link points outside the Mod Profiles Directory, or at the directory itself / a file) or Dangling (link to a profile that no longer exists). Relative link targets resolve against the link's folder; Windows paths compare case-insensitively.main.go:fillGridshows one plain status line at the top ("Active profile: X" or "No active profile: ..."), and the active profile's button is labeled "X (active)", high-importance, with a check icon. Other profiles are unmarked.fillGridre-reads the link, so the mark moves right away on success and stays on the truly active profile on failure; the error dialog is unchanged.Switchitself is untouched (#45/#46 behavior as is).Tests
New
switcher/active_test.go(6 tests): link to a profile (and the mark moving after a switch), relative link, real folder, missing folder, dangling link, link outside the profiles dir. Each test snapshots the tree before/after and fails ifActivechanged anything. No skips; they run in both the Linux Test job and the Windows "Test on windows" step. Local:go test -race -v -shuffle=on ./switcher/= 10/10 PASS;GOOS=windows go vet ./switcher/clean.No CI or release files touched.
Risk / rollback
UI-only plus a read-only helper. Revert is a plain
git revert; no data or config migration.GO on
bb17f12.This does what #49 asks.
Activeonly reads the mods path (Lstat,Readlink,Stat), and the tests snapshot the tree before and after each call, so they'd catch a write. The checks match howSwitchmakes the link (a plain symlink on both platforms), relative targets resolve against the link's folder, and a link to the profiles folder itself or to a file isn't counted as a profile. Re-runningfillGridafter every click keeps the mark honest even when the switch fails.Switchis unchanged.The head is on the current develop tip and all four CI checks are green (Lint, Test, Build, Build windows). No CI, release, dependency or auth changes, so this doesn't need a security review. Linus can merge.