only append the last part of the path specified using InstallDir if it is not also the first

git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@3504 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
kichik 2004-02-27 14:13:08 +00:00
parent ee36f61aa3
commit 4d889381ca

View file

@ -1841,14 +1841,16 @@ int CEXEBuild::doCommand(int which_token, LineParser &line)
}
build_header.install_directory_ptr = add_string(p);
build_header.install_directory_auto_append = 0;
if (*p && *CharPrev(p, p + strlen(p)) != '\\')
char *p2 = p + strlen(p);
if (*p && *CharPrev(p, p2) != '\\')
{
p = build_strlist.get() + build_header.install_directory_ptr;
char *p2 = p + strlen(p);
while (p2 >= p && *CharPrev(p, p2) != '\\') p2--;;
if (p2)
// we risk hitting $\r or something like $(bla\ad) or ${bla\ad} here, but it's better
// than hitting backslashes in processed strings
while (p2 > p && *p2 != '\\')
p2 = CharPrev(p, p2);
if (*p2 == '\\')
{
build_header.install_directory_auto_append = build_header.install_directory_ptr + (p2 - p);
build_header.install_directory_auto_append = add_string(p2 + 1);
}
}
SCRIPT_MSG("InstallDir: \"%s\"\n",line.gettoken_str(1));