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.
This commit is contained in:
parent
36f5b76640
commit
0924a35b67
|
@ -4,6 +4,7 @@ import os
|
||||||
import sys
|
import sys
|
||||||
import argparse
|
import argparse
|
||||||
import platform
|
import platform
|
||||||
|
from pathlib import PurePath
|
||||||
|
|
||||||
if __name__=='__main__':
|
if __name__=='__main__':
|
||||||
parser = argparse.ArgumentParser()
|
parser = argparse.ArgumentParser()
|
||||||
|
@ -15,7 +16,8 @@ if __name__=='__main__':
|
||||||
if os.path.isabs(args.confpath):
|
if os.path.isabs(args.confpath):
|
||||||
destdir = os.environ.get('DESTDIR')
|
destdir = os.environ.get('DESTDIR')
|
||||||
if 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:
|
else:
|
||||||
confpath = args.confpath
|
confpath = args.confpath
|
||||||
else:
|
else:
|
||||||
|
|
Loading…
Reference in New Issue