Open MattAlanWright opened 3 weeks ago
For more context, here is what the same attempt looks like in Python using pathlib
, still running on Windows:
>>> import pathlib
>>> ppp = pathlib.PurePosixPath("/this/is/a/file\named\thing.txt")
>>> ppp.name
'file\named\thing.txt'
>>> ppp.parent
PurePosixPath('/this/is/a')
>>> ppp.parts
('/', 'this', 'is', 'a', 'file\named\thing.txt')
The code snippet below:
prints the following when run on my Windows machine:
Clearly it is interpreting the '\' characters as path separators. However, these are valid filename characters under Posix and I would expect the following output:
I assume this is related to running on Windows. However my understanding was that the
Pure
path types don't care what machine they are being run on. Being able to easily manipulate either Windows or Posix paths from a Windows machine, is what initially drew me to this library.