[PATCH] D71490: [lit] [windows] Make sure to convert all path separators to backslashes in NT style \\?\... paths

Martin Storsjö via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Dec 13 13:37:44 PST 2019


mstorsjo created this revision.
mstorsjo added a reviewer: rnk.
Herald added a subscriber: delcypher.
Herald added a project: LLVM.

E.g. the mingw python distributed in msys2 (the mingw one, which is a normal win32 application and doesn't use the msys2 runtime itself), despite being a normal win32 python, still uses forward slashes. This works fine for other cases, but when constructing a raw NT path, all path separators must be backslashes.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D71490

Files:
  llvm/utils/lit/lit/util.py


Index: llvm/utils/lit/lit/util.py
===================================================================
--- llvm/utils/lit/lit/util.py
+++ llvm/utils/lit/lit/util.py
@@ -151,6 +151,10 @@
             from ctypes import GetLastError, WinError
 
             path = os.path.abspath(path)
+            # Make sure that the path uses backslashes here, in case
+            # python would have happened to use forward slashes, as the
+            # NT path format only supports backslashes.
+            path = '\\'.join(path.split('/'))
             NTPath = to_unicode(r'\\?\%s' % path)
             if not windll.kernel32.CreateDirectoryW(NTPath, None):
                 raise WinError(GetLastError())


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D71490.233868.patch
Type: text/x-patch
Size: 698 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20191213/7f6e060f/attachment.bin>


More information about the llvm-commits mailing list