Skip to content

fix: keep a shortcut that works again, and a cache file's attributes - #3232

Merged
laurentiu021 merged 1 commit into
mainfrom
fix/recheck-shortcuts-keep-attributes
Nov 10, 2026
Merged

laurentiu021 merged 1 commit into
mainfrom
fix/recheck-shortcuts-keep-attributes

Conversation

@laurentiu021

Copy link
Copy Markdown
Owner

Two deletes that acted on what they had seen earlier instead of what is there now.

What changes

  • Shortcut Cleaner judges each ticked shortcut again before deleting it. DeleteShortcuts checked only that the .lnk was still there. The tab keeps the scan's list for the whole session and its rows arrive ticked, so a shortcut that worked again by the time of the delete, its program installed again and the shortcut rewritten at the same path, or a Recent item whose document was put back, was deleted anyway, permanently when Move to Recycle Bin was not ticked, after a confirmation that still called it broken. The scan's judgement of one shortcut is now JudgeShortcut, which both the scan and the delete use, OneDrive-shared folders included. A shortcut that works again is kept and returned in ShortcutDeletion.WorkAgain; the tab takes it off the list and adds "1 works again and was kept." to the status line. A shortcut the shell can no longer read is not shown to be broken and is left.
  • Rebuild icon & thumbnail cache keeps a cache file's attributes. ExplorerShell.DeleteCacheFiles set each file to FileAttributes.Normal before deleting it, which replaces the whole set, so a database Explorer still held stayed on disk without Hidden and System. It clears only ReadOnly now, the attribute that blocks a delete, the way Deep Cleanup has since fix: one directory walk for every service that deletes what it finds #2382. ArchitectureTests.NoFileAttributesAreClearedBySettingThemToNormal reads the app's sources with comments stripped, first shows its pattern catches both the SetAttributes and the Attributes = forms, and fails on any use.
  • README: the Shortcut Cleaner section says each shortcut is judged again before it goes.

How it was checked

  • Without the re-check in DeleteShortcuts, AShortcutThatWorksAgain_IsKept_AndSaidToWorkAgain failed; with the COMException arm narrowed so it no longer catches, AShortcutTheShellCannotReadAgain_IsKept failed. The existing delete tests now hand in a judgement that keeps every shortcut broken and still pass unchanged otherwise.
  • ShortcutCleanerRecheckTests.AShortcutWhoseProgramIsBackBeforeTheDelete_IsKept (integration) writes a real shortcut with the shell to a program in its own temp folder, scans it as broken, creates the program, and deletes: with the production re-check replaced by "always broken" it failed, the shortcut deleted.
  • With FileAttributes.Normal back in DeleteCacheFiles, DeleteCacheFiles_AFileItCannotDelete_KeepsItsAttributes and the architecture test both failed.
  • Unit suite twice, the format check, and all four projects built with no warnings.

Delete selected removed the shortcuts on the scan's list after checking
only that each file was still there. The list lives for the session and
its rows arrive ticked, so a shortcut that worked again by the delete,
its program installed again or its document put back, was deleted
anyway, permanently without the Recycle Bin. The scan's judgement of a
shortcut is now one method, and the delete makes it again for each
ticked shortcut: one that works again is kept, taken off the list and
counted on the status line, and one the shell can no longer read is
left where it is.

Rebuild icon and thumbnail cache set each cache file's attributes to
Normal before deleting it, which replaces the whole set, so a file
Explorer still held stayed on disk without its Hidden and System flags.
It clears only ReadOnly now, as Deep Cleanup does, and an architecture
test fails a build that sets attributes to Normal anywhere in the app.
@laurentiu021
laurentiu021 merged commit 1d4a13b into main Nov 10, 2026
7 checks passed
@laurentiu021
laurentiu021 deleted the fix/recheck-shortcuts-keep-attributes branch November 10, 2026 09:16
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