You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
docs: explain why path.posix.normalize does not replace windows slashes #12298
If I get this right, win32 methods can process both separators, while posix methods don't consider \ a valid separator. Compare how other win32 methods parse paths with / properly, while the posix methods do not this for \:
When multiple, sequential path segment separation characters are found (e.g. / on POSIX and \ on Windows), they are replaced by a single instance of the platform specific path segment separator. Trailing separators are preserved.
which is a little weird so I skimmed it with my understanding, but for postarity this this doesn't work either:
To be fair it is vague enough to have concluded to my understanding... but on a more conceptual/abstract/module angle a conversion looking like this is intended / not available in a path manipulation library or am I missing something?
@Seudein On POSIX, \\ is not a path separator, so I think path.posix.normalize is right in that /\ shouldn’t get contracted into a single /… what would your expected output for that be?
Maybe we need a posix2windows / windows2posix methods
Reacted by Adam Mróz, Lorenzo Dalla Vecchia, Alexander Löhr, Tatsunori Uchino, David Edey, Daniel, Milan Raj, Busticated, Tomáš Hübelbauer, Ger Roza and 11 more
@refack Sorry, could you explain how those methods would behave?
posix2windows would assume the input is a posix path and flip the / (then do some voodoo to try and find on which drive the file exists [or not])
windows2posix would assume that the input is windows and make sure all \ are turned into /
I think what @Seudein assumed was that using path.posix.* on a windows platform will act like windows2posix
Answered. Closing, working as intended.
@bnoordhuis I believe that if a user open an issue based on wrong assumptions that are not addressed in the docs, it should be treated as a bug in the docs.
changed the title [-]path.posix.normalize does not replace windows slashes[/-][+]docs: explain why path.posix.normalize does not replace windows slashes[/+]on Apr 10, 2017
Activity
vsemozhetbyt commentedon Apr 10, 2017
If I get this right,
win32methods can process both separators, whileposixmethods don't consider\a valid separator. Compare how otherwin32methods parse paths with/properly, while theposixmethods do not this for\:bnoordhuis commentedon Apr 10, 2017
Answered. Closing, working as intended.
JestDotty commentedon Apr 10, 2017
the docs say:
which is a little weird so I skimmed it with my understanding, but for postarity this this doesn't work either:
To be fair it is vague enough to have concluded to my understanding... but on a more conceptual/abstract/module angle a conversion looking like this is intended / not available in a path manipulation library or am I missing something?
addaleax commentedon Apr 10, 2017
@Seudein On POSIX,
\\is not a path separator, so I thinkpath.posix.normalizeis right in that/\shouldn’t get contracted into a single/… what would your expected output for that be?refack commentedon Apr 10, 2017
Maybe we need a
posix2windows/windows2posixmethodsaddaleax commentedon Apr 10, 2017
@refack Sorry, could you explain how those methods would behave?
refack commentedon Apr 10, 2017
posix2windowswould assume the input is a posix path and flip the/(then do some voodoo to try and find on which drive the file exists
[or not])windows2posixwould assume that the input is windows and make sure all\are turned into/I think what @Seudein assumed was that using
path.posix.*on a windows platform will act likewindows2posix@bnoordhuis I believe that if a user open an issue based on wrong assumptions that are not addressed in the docs, it should be treated as a bug in the docs.
[-]path.posix.normalize does not replace windows slashes[/-][+]docs: explain why path.posix.normalize does not replace windows slashes[/+]refack commentedon Apr 10, 2017
Reopened as a
docbugaddaleax commentedon Apr 10, 2017
pathmethods generally don’t actually query the file system, I would like to keep it that way.refack commentedon Apr 10, 2017
I agree. Super important!
I was sarcastic, I was hoping the huge emoji and [or not] would convey that, sorry...
doc: improve path.posix.normalize docs
doc: improve path.posix.normalize docs
doc: improve path.posix.normalize docs
doc: improve path.posix.normalize docs