From d39510ec1cda7c7808c1ecadb1364382f92c1af3 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Martin=20Storsj=C3=B6?= Date: Fri, 13 Dec 2019 21:28:19 +0000 Subject: [PATCH] [lit] [windows] Make sure to convert all path separators to backslashes in NT style \\?\... paths 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 (many, but not all), but when constructing a raw NT path, all path separators must be backslashes. Differential Revision: https://reviews.llvm.org/D71490 --- llvm/utils/lit/lit/util.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/llvm/utils/lit/lit/util.py b/llvm/utils/lit/lit/util.py index c662be3..fa752d0 100644 --- a/llvm/utils/lit/lit/util.py +++ b/llvm/utils/lit/lit/util.py @@ -151,6 +151,10 @@ def mkdir(path): 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 = path.replace('/', '\\') NTPath = to_unicode(r'\\?\%s' % path) if not windll.kernel32.CreateDirectoryW(NTPath, None): raise WinError(GetLastError()) -- 2.7.4