Closed GoogleCodeExporter closed 9 years ago
Pyfilesystem paths use forward slashes, even on Windows. Please read the docs:
http://pythonhosted.org/fs/concepts.html#paths
Original comment by willmcgugan
on 12 Jul 2013 at 8:30
Does that mean that all callers should call fs.path.normpath on all paths
before calling any API from pyfilesystem? Would it be possible to bake that in
the API's themselves?
Original comment by kunalpar...@gmail.com
on 12 Jul 2013 at 3:47
If you are working within a Pyfilesystem, then just use forward slashes in
literals. It ensures everything works cross-platform. Only the OSFS constructor
takes a path that is in the OS format.
Don't rely on normpath changing backslashes to forwardslashes though. That
functionality may change in the future. There was a recent-ish discussion in
the mailing list. The problem is that backslashes are valid path characters in
Linux and Mac.
Original comment by willmcgugan
on 12 Jul 2013 at 4:03
Nah, I think you've not quite understood how pyfilesystem works ;-) Try
re-reading the concepts page Will linked to.
Basically, pyfilesystem is only designed for dealing with paths *within
pyfilesystem*, rather than being called on system paths (although there are
functions to get a system path back out of pyfilesystem if needed).
So, use system paths ('c:\foo\bar' etc.) with regular Python functions (e.g.
from the os.path module), and use pyfilesystem paths ('/foo/bar' etc.) within
pyfilesystem.
Pyfilesystem is designed to "abstract away" filesystem paths, allowing you to
treat paths from all the different FS modules (and across all different OSes)
in the same way.
Original comment by gc...@loowis.durge.org
on 12 Jul 2013 at 4:08
Original issue reported on code.google.com by
kunalpar...@gmail.com
on 12 Jul 2013 at 5:33