From 0924a35b6755baaaa4af7c9c2c6001c4ff7bea3d Mon Sep 17 00:00:00 2001 From: Xavier Claessens Date: Tue, 13 Sep 2022 08:51:36 -0400 Subject: [PATCH] link_confs.py: Fix prepending DESTDIR to absolute path Stripping the first char of a path to make it relative only works with UNIX paths like '/prefix' but not with Windows paths like 'c:\prefix'. This copies the code Meson uses. --- conf.d/link_confs.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/conf.d/link_confs.py b/conf.d/link_confs.py index 52b8093..11e759a 100644 --- a/conf.d/link_confs.py +++ b/conf.d/link_confs.py @@ -4,6 +4,7 @@ import os import sys import argparse import platform +from pathlib import PurePath if __name__=='__main__': parser = argparse.ArgumentParser() @@ -15,7 +16,8 @@ if __name__=='__main__': if os.path.isabs(args.confpath): destdir = os.environ.get('DESTDIR') if destdir: - confpath = os.path.join(destdir, args.confpath[1:]) + # c:\destdir + c:\prefix must produce c:\destdir\prefix + confpath = str(PurePath(destdir, *PurePath(args.confpath).parts[1:])) else: confpath = args.confpath else: