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
|
@ -718,6 +718,22 @@ tstring remove_file_extension(const tstring& path) {
|
|||
return get_string_prefix(path, _T("."));
|
||||
}
|
||||
|
||||
static int PathGetDosDriveNumber(const TCHAR *p)
|
||||
{
|
||||
// Note: Unlike PathGetDriveNumber(), we require a path separator after the colon.
|
||||
if (p[0] && _T(':') == p[1] && IsAgnosticPathSeparator(p[2]))
|
||||
{
|
||||
const TCHAR loch = p[0]|32;
|
||||
if (loch >= _T('a') && loch <= _T('z')) return loch - _T('a');
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
bool IsWindowsPathRelative(const TCHAR *p)
|
||||
{
|
||||
if (_T('\\') == p[0]) return _T('\\') != p[1]; // Current drive relative, not (unverified) UNC
|
||||
return PathGetDosDriveNumber(p) < 0;
|
||||
}
|
||||
|
||||
struct ToLower
|
||||
{
|
||||
TCHAR operator() (TCHAR c) const { return _totlower(c); }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue