Skip to content

Fix long path error 123 for copy/move/delete (#34)#35

Merged
0xeb merged 1 commit intomainfrom
fix/issue-34-longpath-copymove
Feb 25, 2026
Merged

Fix long path error 123 for copy/move/delete (#34)#35
0xeb merged 1 commit intomainfrom
fix/issue-34-longpath-copymove

Conversation

@0xeb
Copy link
Owner

@0xeb 0xeb commented Feb 25, 2026

Summary

  • Fix ERROR_INVALID_NAME (error 123) when copying/moving/deleting files with paths >260 chars and ANSI-only item names
  • BuildScriptFromSnapshot only populated wide paths (SourceNameW/TargetNameW) when item.NameW was set — ANSI-only items got no wide paths, so the worker fell back to ANSI APIs which fail on long paths
  • Add else if fallback at all 5 affected locations: widen the ANSI name and pass through SetSourceNameW/SetTargetNameW which applies \?\ prefix
  • Also fix the existing delete fallback which used BuildWidePath() (no \?\ prefix) instead of SetSourceNameW

Test plan

  • 10 new tests in gtest_longpath_copymove (all passing)
    • Copy/Move/Delete with ANSI-only items on paths >260 chars
    • Unit tests for \?\ prefix logic (short path, long path, UNC path)
  • Full Release build passes
  • Manual test: copy a file from a >260 char path in Sally

Closes #34

BuildScriptFromSnapshot only populated wide paths (SourceNameW/TargetNameW)
when items had NameW set. ANSI-only items got no wide paths, so ANSI APIs
failed with ERROR_INVALID_NAME (123) on paths exceeding MAX_PATH.

Add else-if fallback at all 5 locations: widen the ANSI name and pass it
through SetSourceNameW/SetTargetNameW which applies \?\ prefix for long
paths. Also fix the delete fallback which used BuildWidePath (no prefix)
instead of SetSourceNameW. Remove now-unused BuildWidePath helper.
@0xeb 0xeb merged commit 72ec58d into main Feb 25, 2026
6 checks passed
@0xeb 0xeb deleted the fix/issue-34-longpath-copymove branch February 25, 2026 03:26
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.

Copy / move with long path/filenames : error

1 participant