Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove sourceFullPath from Unix FileSystem.MoveDirectory exception #55658

Merged
merged 8 commits into from
Jul 16, 2021
Merged

Remove sourceFullPath from Unix FileSystem.MoveDirectory exception #55658

merged 8 commits into from
Jul 16, 2021

Conversation

steveberdy
Copy link
Contributor

@steveberdy steveberdy commented Jul 14, 2021

Summary

Removes the sourceFullPath argument from the exception thrown when a destination file path for Directory.Move has a parent that doesn't exist in Unix. This matches the functionality of Windows. The results should be more consistent and less confusing exceptions from the Directory.Move method on both Unix and Windows platforms.

For reference, see the first possible solution for this problem #50833 (comment):

I see 2 possible solutions:

  • Remove the path from the error message of the exception, as done on Windows side.
  • Add extra checks (on Windows and Unix sides) to ensure the parent (destination) directory exists.

Other minor fixes

  • Typos in documentation fixed

Fixes #50833

@ghost
Copy link

ghost commented Jul 14, 2021

Tagging subscribers to this area: @dotnet/area-system-io
See info in area-owners.md if you want to be subscribed.

Issue Details

Summary

Removes the sourceFullPath argument from the exception thrown when a destination file path for Directory.Move has a parent that doesn't exist in Unix. This matches the functionality of Windows. The results should be more consistent and less confusing exceptions from the Directory.Move method on both Unix and Windows platforms.

For reference, see the first possible solution for this problem (#50833 (comment)):

I see 2 possible solutions:

  • Remove the path from the error message of the exception, as done on Windows side.
  • Add extra checks (on Windows and Unix sides) to ensure the parent (destination) directory exists.

Other minor fixes

  • Multiple if-statements were condensed to one switch, making code more performant
  • Typos in documentation fixed

Fixes #50833

Author: steveberdy
Assignees: -
Labels:

area-System.IO

Milestone: -

@stephentoub
Copy link
Member

stephentoub commented Jul 15, 2021

Multiple if-statements were condensed to one switch, making code more performant

For reference, not really. The compiler's still going to generate cascading ifs, similar to the original source code:
sharplab

@stephentoub stephentoub merged commit fb2e673 into dotnet:main Jul 16, 2021
@stephentoub
Copy link
Member

Thanks.

@steveberdy steveberdy deleted the sb-50833 branch July 20, 2021 15:48
@ghost ghost locked as resolved and limited conversation to collaborators Aug 19, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Directory.Move throws invalid exception message
3 participants