pathlib icon indicating copy to clipboard operation
pathlib copied to clipboard

Is this a bug in the 'IPurePath.Join()' method? It creates a 'NEW' path, instead of joining the path from the 'Current Path'

Open jeffward01 opened this issue 2 years ago • 2 comments

Hello!

As I was working with the library, this method kept throwing me off:

image

The documentation says join current path with provided paths. I would think that it would only accept relative paths. However it accepts Absolute Paths (which is fine).

The behavior of the method is that it creates a new path, instead of joining the new paths with the existing current path.

Is this a bug? How would you like to handle this, or is this 100% acceptable?


Expected (based on the comments and xml descriptors)

  • If an absolute Path is provided, an exception is thrown
  • All provided paths are appended (joined) with the existing path

Actual

  • A new path is created from the provided paths
  • The new path is 100% unrelated to the previous 'current path' (It is brand new) and build from the provided paths

Just wondering your thoughts!

PS: I plan to submit some Zero-Allocation path checking code I have been working on in a pull request soon. I want to rip out some of that Regex stuff and replace it with quicker ReadonlySpan<char>, especially since we have a finite number of validation cases we are checking for.

jeffward01 avatar May 22 '22 08:05 jeffward01