Skip to content

feat: ✨ show clear, localized messages after creating a link - #46

Merged
amd989 merged 2 commits into
masterfrom
claude/link-result-messages-5d76c1
Nov 18, 2026
Merged

amd989 merged 2 commits into
masterfrom
claude/link-result-messages-5d76c1

Conversation

@amd989

@amd989 amd989 commented Nov 17, 2026

Copy link
Copy Markdown
Owner

Summary

After creating a link, Symlinker used to show mklink's raw output, for example symbolic link created for D:\...\accounts\Test <<===>> D:\...\benchmarks. It was in the language of Windows instead of the app's, and long paths wrapped mid-path in the small dialog. Now Symlinker decides the outcome itself and shows a formatted, localized message.

Success (title per link type, names in a sentence, each path on its own line):

Symbolic link created

"Test" now points to "benchmarks".

Link: C:\...\scratchpad\Documents\Anno 1800\accounts\Test
Target: C:\...\scratchpad\Documents\Anno 1800\benchmarks

Hard links say "Test.txt" is now another name for the file "benchmarks.txt". Junctions get "Junction created".

Failure (plain headline, mapped reason, mklink's text only when unmapped):

Couldn't create the link

A hard link has to be on the same drive as its target. Use a symbolic link instead.

Changes

  • Success is decided by Symlinker. LinkCommand.RunAsync uses the exit code, then LinkCheck.IsCreated confirms on disk that the link is there and leads to the target: the stored LinkTarget for symbolic links and junctions (relative symbolic link targets resolve against the link's folder), and the same volume and file index for hard links. Exit code 0 without a link is reported as NotCreated.
  • Failures get a reason code. LinkResult has a new Error (LinkError). LinkCheck.Diagnose maps the common cases from what is on disk, never from mklink's text:
    • something already at the link path (checked before mklink runs)
    • hard link to another drive
    • junction to a network folder
    • no symbolic link privilege
    • folder access denied (a real probe file in the link's folder)
    • anything else is Unknown, and mklink's own text is shown as the detail
  • Elevated helper. The checks run in the process that ran mklink, so the helper diagnoses with its own rights. LinkResult still only holds plain values; Error travels over the pipe as a number. Both ends are the same exe, and the in-process pipe test now also checks a LinkExists reply.
  • LinkResultMessage (new, self-contained) builds the title and text. Long paths are shortened in the middle (D:\...\Anno 1800\accounts\Test, 52 characters max) so each fits on one line after the longest label (Italian "Destinazione:").
  • Move and link uses the same title and path lines (LinkResultMessage.ForMove), and its rollback message uses Reason() instead of raw mklink output.
  • Dialog width. An implicit style gives MessageDialog most of the window width (MahApps keeps only the middle half by default). This applies to all message dialogs.
  • Strings. 15 new Result* strings, grouped where LinkSuccessfullyCreated was, in all 9 languages, with typed properties in Resources.Designer.cs. LinkSuccessfullyCreated is removed.

Reuse point for batch links (#6)

The batch summary can format each row without touching the dialog code:

  • LinkResultMessage.For(request, result) returns (Title, Message) for one link.
  • LinkResultMessage.Reason(request, result) returns a single localized failure line, suitable for a row.
  • LinkResultMessage.CompactPath(path) shortens a path for a narrow column.

LinkResult.Message keeps its name and still holds mklink's raw text, so existing callers keep compiling.

Testing

  • dotnet test --project Symlinker.Tests: 226 passed, 0 skipped, 100% line, branch and method coverage.
  • New LinkCheckTests (real junctions, hard links and symbolic links, a deny ACL for the access check, a locked file for the same-file fallback) and LinkResultMessageTests (every reason, every link type, path shortening).
  • Ran the real window with a small driver that fills the form, clicks Create link and renders the dialog. Checked symbolic link, junction and hard link in light and dark, the hard link across drives failure, and move and link. Checked the symbolic link dialog in all 9 languages, plus junction and failure in de, it and fr: nothing wraps mid-path or scrolls.
  • Not run by hand: the elevated helper path. Developer Mode is on on the test PC, so symbolic links don't go through the helper, and toggling it is a system setting. The pipe test covers the helper returning a reason code.

🤖 Generated with Claude Code

Symlinker used to show mklink's raw output after creating a link, for
example "symbolic link created for <link> <<===>> <target>". It is in the
language of Windows, not the app's, and long paths wrapped mid-path in
the small dialog.

- Decide success from the exit code, then confirm on disk that the link
  is there and leads to the target (LinkCheck.IsCreated): the stored
  target for symbolic links and junctions, the same file for hard links.
- On failure, LinkCheck.Diagnose maps common causes to a LinkError code:
  link path taken, hard link across drives, junction to a network folder,
  no symbolic link privilege, folder access denied. mklink's text stays
  as the detail for anything else. The code travels over the elevated
  helper's pipe as a number, so both paths report the same way.
- LinkResultMessage builds the dialog: a title per link type ("Symbolic
  link created"), a sentence with the names, and the link and target
  paths on their own lines, shortened in the middle when long. The move
  and link flow uses it too, and its failure text uses Reason().
- Message dialogs use most of the window width so a path fits on a line.
- New strings in all 9 languages; LinkSuccessfullyCreated is gone.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Set "What's new" in all 9 languages for the link result messages and
the Store version's AppData move guard, and point ReleaseNotesVersion
at 4.4.0 so the release job uses them.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@amd989
amd989 merged commit 9ddf0eb into master Nov 18, 2026
1 check passed
@amd989
amd989 deleted the claude/link-result-messages-5d76c1 branch November 18, 2026 12:07
amd989 added a commit that referenced this pull request Nov 18, 2026
Brings in #46 (localized link result messages). Batch and single links
now report results through LinkResultMessage: created links get the new
titles and text, failures in the batch summary use Reason(), and a
failed link during a move rolls back with that reason.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant