ReserveFile /plugin now searches folders added with !AddPluginDir

git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@6591 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
anders_k 2015-07-27 19:32:32 +00:00
parent 6361cfb1f6
commit c679845ad6
3 changed files with 17 additions and 5 deletions

View file

@ -233,6 +233,14 @@ bool Plugins::Initialize(const TCHAR*arcsubdir, bool displayInfo)
return true;
}
bool Plugins::FindDllPath(const tstring filename, tstring&dllPath)
{
tstring dllName = remove_file_extension(filename);
if (!contains(m_dllname_to_path, dllName)) return false;
dllPath = get_paired_value(m_dllname_to_path, dllName);
return true;
}
bool Plugins::GetCommandInfo(const tstring&command, tstring&canoniccmd, tstring&dllPath)
{
const tstring dllname = GetDllName(command);

View file

@ -50,6 +50,7 @@ class Plugins
bool Initialize(const TCHAR*arcsubdir, bool displayInfo);
void AddPluginsDir(const tstring& path, bool displayInfo);
bool FindDllPath(const tstring filename, tstring&dllPath);
bool IsPluginCommand(const tstring& command) const;
bool IsKnownPlugin(const tstring& token) const;
bool GetCommandInfo(const tstring&command, tstring&canoniccmd, tstring&dllPath);

View file

@ -4765,10 +4765,13 @@ int CEXEBuild::doCommand(int which_token, LineParser &line)
tstring pluginfullpath;
if (reserveplugin && get_file_name(t)==t)
{
pluginfullpath = definedlist.find(_T("NSISDIR"));
pluginfullpath += tstring(PLATFORM_PATH_SEPARATOR_STR) + _T("Plugins");
pluginfullpath += tstring(PLATFORM_PATH_SEPARATOR_STR) + get_target_suffix();
pluginfullpath += tstring(PLATFORM_PATH_SEPARATOR_STR) + t;
if (!m_pPlugins || !m_pPlugins->FindDllPath(t, pluginfullpath))
{
pluginfullpath = definedlist.find(_T("NSISDIR"));
pluginfullpath += tstring(PLATFORM_PATH_SEPARATOR_STR) + _T("Plugins");
pluginfullpath += tstring(PLATFORM_PATH_SEPARATOR_STR) + get_target_suffix();
pluginfullpath += tstring(PLATFORM_PATH_SEPARATOR_STR) + t;
}
t = (TCHAR*) pluginfullpath.c_str();
}
int tf=0;
@ -6095,7 +6098,7 @@ int CEXEBuild::doCommand(int which_token, LineParser &line)
if (comma++) es += _T(", /");
es += ts;
}
ERROR_MSG(_T("Error: %") NPRIs _T("\n"),es.c_str());
ERROR_MSG(_T("Error: %") NPRIs _T("\n"), es.c_str());
return PS_ERROR;
}
}