Eryk Sun <eryk...@gmail.com> added the comment:
Please consult the attached file "splitdrive.py". I redesigned splitdrive() to support "UNC" and "GLOBAL" junctions in device paths. I relaxed the design to allow repeated separators everywhere except for the UNC root. IIRC, Windows has supported this since XP. For example: >>> print(nt._getfullpathname('//server///share')) \\server\share >>> print(nt._getfullpathname(r'\\server\\\share')) \\server\share There are also a couple of minor behavior changes in the new implementation. The old implementation would split "//server/" as ('//server/', ''). Since there's no share, this should not count as a drive. The new implementation splits it as ('', '//server/'). Similarly it splits '//?/UNC/server/' as ('', '//?/UNC/server/'). The old implementation also allowed any character as a drive 'letter'. For example, it would split '/:/spam' as ('/:', '/spam'). The new implementation ensures that the drive letter in a DOS drive is alphabetic. I also extended test_splitdrive to use a list of test cases in order to avoid having to define each case twice. It calls tester() a second time for each case, with slash and backslash swapped. ---------- Added file: https://bugs.python.org/file48607/splitdrive.py _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue37609> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com