Skip to content

feat: ✨ create several links in one step - #47

Open
amd989 wants to merge 2 commits into
masterfrom
claude/batch-links-429c14
Open

amd989 wants to merge 2 commits into
masterfrom
claude/batch-links-429c14

Conversation

@amd989

@amd989 amd989 commented Nov 17, 2026 •

Copy link
Copy Markdown
Owner

Summary

Closes #6. Symlinker can now create several links in one step.

  • Add another (footer, next to About) turns the form into a list of links. With one link the window looks and works exactly as before; removing rows back down to one returns to that view.
  • Editing model: the two cards edit the selected row. The list shows every row on one line, folder\name -> folder\target (the folder parts get trimmed, the names never do), with a remove button. Click a row to edit it in the cards; Delete removes the selected row. Each row keeps its own link name auto-fill, so a typed name in one row never affects another.
  • The field order stays the same: link location first, then the target.

Shortcuts for the issue's case (many folders from C:\FolderA linked into C:\FolderB)

  • A new row starts in the last row's link location, and its target picker opens next to the nearest target above it.
  • Picking several targets at once (multi-select in the folder or file picker) or dropping several items on the target card fills the selected row and adds a row for each other item, all in the current link location, each named after its target. So the issue's case is one location pick plus one multi-select.
  • Picking or dropping a link location also moves the rows that shared the old location (or had none yet). Typing only changes the selected row.

One type for the batch, validation

  • The existing pills set one mode and link type for the whole batch. In batch mode switching mode keeps every target; ones that don't fit (a file in folder mode, so a junction to a file, or a folder in file mode, so a hard link to a folder) are flagged on Create.
  • Create validates every row first: InputValidator per row plus duplicate link paths (case-insensitive). Bad rows get an error icon with a tooltip, the first one is selected so its fields are marked in the cards, and the footer shows its message (or "Fix the links marked in the list." when the selected row is fine).

Creating the links

New LinkCreator.CreateBatchAsync(). LinkCreator now plans each link first (LinkPlan: checks and questions, nothing on disk changes) and then carries it out, returning a LinkOutcome. The single link path uses the same plan/execute code, with the same dialogs as before.

  1. Every replace or move question is asked first, each prefixed with the link path it is about. Saying no skips that link.
  2. ILinkRunner.PrepareAsync() is called once, so at most one UAC prompt for the batch. Declining it stops quietly with nothing changed.
  3. Each link is created; failures (and per-row exceptions) don't stop the rest. Moves keep their progress dialog and rollback per row.
  4. One summary dialog: "Created N of M links.", then what was created and what wasn't, with the reason. Links in the batch's main folder are listed by name, others by full path. A move whose old copy couldn't be removed is listed with that note.
  5. If some links weren't created, the created rows are removed from the list, so trying again only redoes the rest.

Window size

560x280 for a single link. In batch mode it grows 30 px per row up to 5 rows (438 px), then the list scrolls. Back to 280 when one row is left.

Strings

11 new strings, grouped at the end of Resources.resx and all 8 translations under a <!-- Batch links (#6) --> comment, with typed properties appended to Resources.Designer.cs. Checked German, Italian and French for overflow in the footer and buttons (the "rows need fixing" message was shortened after it truncated in German and Italian).

Testing

  • dotnet test --project Symlinker.Tests: 219 passed, coverage gate at 100% line, branch and method. New LinkBatchTests (rows, auto-fill, shortcuts, validation, duplicates) and LinkCreatorBatchTests (questions before changes, one prepare, continue past failures, skipped rows, declined UAC, planning errors, summary format, leftover copy note).
  • Ran the built app, driving it through UI Automation:
    • Symbolic links: 5 rows (Photos, Music, Documents, Projects into FolderB, plus one in C:\Windows). FolderB\Music already existed as a real folder: the move question came first, the folder was moved to the target and linked. Result: 4 created, C:\Windows\Games: Access is denied.
    • Junctions: 6 rows, three of them added with one multi-select in the folder picker (which opened in FolderA, the previous target's folder). Junctions\Photos existed: declined the replace question, so it was skipped and left untouched. C:\Windows\Photos failed. 4 created.
    • Hard links: 4 rows in file mode. FileLinks\todo.txt existed: accepted the replace question, it became a hard link. One row on another drive failed with "The system cannot move the file to a different disk drive." 3 created.
    • Validation: a file target in folder mode and a duplicate link path were both flagged inline before anything ran.
  • Took screenshots of the single and batch views in light and dark themes (light through a scratch host that forces the light theme, since Windows here is in dark mode). They still need to be dragged into this PR by hand.

amd989 and others added 2 commits November 17, 2026 07:53
"Add another" in the footer turns the form into a list of links. The
cards edit the selected row and the list shows every row on one line,
with a remove button. A single link looks and works as before.

- A new row starts in the last row's link location, and its target
  picker opens next to the previous target
- Picking several targets (multi-select) or dropping several items on
  the target card adds a row for each
- Every row is validated first, including duplicate link paths, and
  bad rows are marked in the list
- All replace/move questions come before anything on disk changes,
  then one UAC prompt at most, then each link; failures don't stop
  the rest and one summary lists what happened
- The window grows for up to 5 rows, then the list scrolls

Closes #6

Co-Authored-By: Claude Opus 5.5 <[email protected]>
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]>

This branch has not been deployed

No deployments
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.

Create Bulk Links

1 participant