TOK_CREATEDIR tries to reject relative paths because EW_CREATEDIR silently fails if faced with one
git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@6488 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
parent
37233030e1
commit
f19f561f40
3 changed files with 28 additions and 12 deletions
|
@ -4128,33 +4128,32 @@ int CEXEBuild::doCommand(int which_token, LineParser &line)
|
|||
return add_entry(&ent);
|
||||
case TOK_SETOUTPATH:
|
||||
{
|
||||
const TCHAR *op=line.gettoken_str(1);
|
||||
const TCHAR *op=line.gettoken_str(1), *cmdname=_T("SetOutPath");
|
||||
if (!_tcscmp(op,_T("-"))) op=_T("$INSTDIR");
|
||||
|
||||
SCRIPT_MSG(_T("SetOutPath: \"%") NPRIs _T("\"\n"),op);
|
||||
SCRIPT_MSG(_T("%") NPRIs _T(": \"%") NPRIs _T("\"\n"),cmdname,op);
|
||||
ent.which=EW_CREATEDIR;
|
||||
ent.offsets[0]=add_string(op);
|
||||
ent.offsets[1]=1;
|
||||
|
||||
DefineInnerLangString(NLF_OUTPUT_DIR);
|
||||
}
|
||||
return add_entry(&ent);
|
||||
case TOK_CREATEDIR:
|
||||
{
|
||||
const TCHAR *cmdname=_T("CreateDirectory");
|
||||
TCHAR out_path[NSIS_MAX_STRLEN], *p=line.gettoken_str(1);
|
||||
if (*p == _T('-')) out_path[0]=0;
|
||||
bool badpath=IsWindowsPathRelative(p) && _T('$') != *p; // ExeHead will have to deal with expanded $variables...
|
||||
if (badpath)
|
||||
ERROR_MSG(_T("%") NPRIs _T(": Relative paths not supported\n"),cmdname);
|
||||
else
|
||||
{
|
||||
if (p[0] == _T('\\') && p[1] != _T('\\')) p++;
|
||||
my_strncpy(out_path,p,COUNTOF(out_path));
|
||||
p=CharPrev(out_path,out_path+_tcslen(out_path));
|
||||
if (_T('\\') == *p || _T('/') == *p) *p=0; // remove trailing slash
|
||||
if (IsAgnosticPathSeparator(*p)) *p=0; // remove trailing slash
|
||||
}
|
||||
if (!*out_path) PRINTHELP()
|
||||
SCRIPT_MSG(_T("CreateDirectory: \"%") NPRIs _T("\"\n"),out_path);
|
||||
if (badpath || !*out_path) PRINTHELP()
|
||||
SCRIPT_MSG(_T("%") NPRIs _T(": \"%") NPRIs _T("\"\n"),cmdname,out_path);
|
||||
ent.which=EW_CREATEDIR;
|
||||
ent.offsets[0]=add_string(out_path);
|
||||
|
||||
DefineInnerLangString(NLF_CREATE_DIR);
|
||||
}
|
||||
return add_entry(&ent);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue