Address ntpath bug with empty prefix

This patch addresses the bug described in issue #2225 where in using
posix paths and an empty PREFIX value can result in files being
installed to the root of the drive specified by destdir instead of to
the desired prefix value.  This is a bug in the assumption that user
specified paths that are strings will contain directory separators that
match the target operating system.
This commit is contained in:
James Harris 2019-02-18 11:38:45 -06:00
parent bd3431e483
commit 17b69226c4
1 changed files with 2 additions and 2 deletions

View File

@ -1054,7 +1054,7 @@ class inst(Task.Task):
def get_install_path(self, destdir=True):
"""
Returns the destination path where files will be installed, pre-pending `destdir`.
Relative paths will be interpreted relative to `PREFIX` if no `destdir` is given.
:rtype: string
@ -1062,7 +1062,7 @@ class inst(Task.Task):
if isinstance(self.install_to, Node.Node):
dest = self.install_to.abspath()
else:
dest = Utils.subst_vars(self.install_to, self.env)
dest = os.path.normpath(Utils.subst_vars(self.install_to, self.env))
if not os.path.isabs(dest):
dest = os.path.join(self.env.PREFIX, dest)
if destdir and Options.options.destdir: