From f71c9aebfbceb8623756b981392b6d6d2b4e7c22 Mon Sep 17 00:00:00 2001 From: Nirbheek Chauhan Date: Sat, 29 Apr 2023 16:24:18 +0530 Subject: [PATCH] wrap: Always pass posix paths to patch patch on Windows is provided by MSYS, which only understands POSIX paths, with `/`. Using Windows paths with `\` results in a "file not found" error. We got a little lucky here because the path is relative, so the drive letter difference doesn't affect us. --- mesonbuild/wrap/wrap.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mesonbuild/wrap/wrap.py b/mesonbuild/wrap/wrap.py index d1ed31246..b63d7a43e 100644 --- a/mesonbuild/wrap/wrap.py +++ b/mesonbuild/wrap/wrap.py @@ -794,7 +794,8 @@ class Resolver: raise WrapException(f'Diff file "{path}" does not exist') relpath = os.path.relpath(str(path), self.dirname) if PATCH: - cmd = [PATCH, '-f', '-p1', '-i', relpath] + # Always pass a POSIX path to patch, because on Windows it's MSYS + cmd = [PATCH, '-f', '-p1', '-i', str(Path(relpath).as_posix())] elif GIT: # If the `patch` command is not available, fall back to `git # apply`. The `--work-tree` is necessary in case we're inside a