Skip to content

Improve legacy Windows error diagnostics - #120

Open
dajiaohuang wants to merge 1 commit into
arsenetar:masterfrom
dajiaohuang:repostew/send2trash-117-diagnostics-20261028
Open

dajiaohuang wants to merge 1 commit into
arsenetar:masterfrom
dajiaohuang:repostew/send2trash-117-diagnostics-20261028

Conversation

@dajiaohuang

Copy link
Copy Markdown

Summary

Addresses the legacy-backend diagnostics described in #117. SHFileOperationW returns its own shell status (for example DE_INVALIDFILES, 0x7c), which this backend maps to an approximate Win32 winerror; it also currently reports the short path passed to the shell. Preserve the decoded caller path list and expose the original shell status as OSError.sh_file_operation_result, while retaining the existing mapped winerror and message behavior.

This does not change shell/recycle behavior or claim to fix the loaded-hard-link refusal. It is separate from #118's preflight for paths that Windows would permanently delete.

Validation

  • py -3.13 -B -m pytest tests/test_win_legacy_diagnostics.py -q — 1 passed on Windows. The test mocks short-path conversion, SHFileOperationW, and FormatError; it creates no path and invokes no trash API.
  • py -3.13 -B -m py_compile send2trash/win/legacy.py tests/test_win_legacy_diagnostics.py — passed.
  • git diff --check — passed.

The existing Windows platform tests/full suite were not run because they invoke native trash APIs and can move files into the host Recycle Bin. flake8 was unavailable in the existing Python environment; no package was installed. CI/review status is not claimed.

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