Commit 18201481 by rfkelly0

(hopefully) fix handling of remote UNC paths in OSFS

parent 36b841d6
......@@ -44,9 +44,12 @@
for wildcards.
* Added listdirinfo method, which yields both the entry names and the
corresponding info dicts in a single operation.
* Fixed operation of OSFS on win32 when it points to the root of a drive.
* Made SubFS a subclass of WrapFS, and moved it into its own module at
fs.wrapfs.subfs.
* Path-handling fixes for OSFS on win32:
* Work properly when pointing to the root of a drive.
* Better handling of remote UNC paths.
* Add ability to switch off use of long UNC paths.
* OSFSWatchMixin improvements:
* watch_inotify: allow more than one watcher on a single path.
* watch_win32: don't create immortal reference cycles.
......@@ -65,7 +68,8 @@
* Added a getmmap to base
* Added command line scripts fsls, fstree, fscat, fscp, fsmv
* Added command line scripts fsmkdir, fsmount
* Made SFTP automatically pick up keys if no other authentication is available
* Made SFTP automatically pick up keys if no other authentication
is available
* Optimized listdir and listdirinfo in SFTPFS
* Made memoryfs work with threads
* Added copyfile_non_atomic and movefile_non_atomic for improved performance of multi-threaded copies
......
......@@ -84,7 +84,7 @@ class OSFS(OSFSXAttrMixin, OSFSWatchMixin, FS):
'atomic.setcontents' : False,
}
def __init__(self, root_path, thread_synchronize=_thread_synchronize_default, encoding=None, create=False, dir_mode=0700):
def __init__(self, root_path, thread_synchronize=_thread_synchronize_default, encoding=None, create=False, dir_mode=0700, use_long_paths=True):
"""
Creates an FS object that represents the OS Filesystem under a given root path
......@@ -99,14 +99,18 @@ class OSFS(OSFSXAttrMixin, OSFSWatchMixin, FS):
super(OSFS, self).__init__(thread_synchronize=thread_synchronize)
self.encoding = encoding or sys.getfilesystemencoding()
self.dir_mode = dir_mode
self.use_long_paths = use_long_paths
root_path = os.path.expanduser(os.path.expandvars(root_path))
root_path = os.path.normpath(os.path.abspath(root_path))
# Enable long pathnames on win32
if sys.platform == "win32":
if not root_path.startswith("\\\\?\\"):
root_path = u"\\\\?\\" + root_path
if use_long_paths and not root_path.startswith("\\\\?\\"):
if not root_path.startswith("\\"):
root_path = u"\\\\?\\" + root_path
else:
root_path = u"\\\\?" + root_path
# If it points at the root of a drive, it needs a trailing slash.
if len(root_path) == 6:
if len(root_path) == 6 and not root_path.endswith("\\"):
root_path = root_path + "\\"
if create:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment