[llvm] [LIT][Cygwin] Skip pre-check for existence in mkdir-p (PR #163948)

Alexander Richardson via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 17 10:06:59 PDT 2025


================
@@ -164,14 +164,7 @@ def mkdir(path):
 def mkdir_p(path):
     """mkdir_p(path) - Make the "path" directory, if it does not exist; this
     will also make directories for any missing parent directories."""
-    if not path or os.path.exists(path):
-        return
-
-    parent = os.path.dirname(path)
-    if parent != path:
-        mkdir_p(parent)
-
-    mkdir(path)
+    os.makedirs(path, exist_ok=True)
----------------
arichardson wrote:

This looks much simpler, nice. Not a Windows expert but do we need to remap long paths using something like this?
```suggestion
    if platform.system() == "Windows":
    if not path.startswith(r"\\?\"):
        path = r"\\?\" + path
    os.makedirs(path, exist_ok=True)
```

https://github.com/llvm/llvm-project/pull/163948


More information about the llvm-commits mailing list