Define the plugin-list's path for Plugin Admin

It will be in plugins/Config/
This commit is contained in:
Don HO 2018-09-21 20:16:30 +02:00
parent bfff12fd9c
commit da49749438
2 changed files with 32 additions and 11 deletions

View File

@ -418,30 +418,50 @@ vector<PluginUpdateInfo*> PluginViewList::fromUiIndexesToPluginInfos(const std::
PluginsAdminDlg::PluginsAdminDlg()
{
// Get wingup path
NppParameters *pNppParameters = NppParameters::getInstance();
_updaterDir = pNppParameters->getNppPath();
PathAppend(_updaterDir, TEXT("updater"));
_updaterFullPath = _updaterDir;
PathAppend(_updaterFullPath, TEXT("gup.exe"));
// get plugin-list path
_pluginListFullPath = getPluginConfigPath();
#ifdef DEBUG // if not debug, then it's release
// load from nppPluginList.json instead of nppPluginList.dll
_pluginListFullPath = TEXT("C:\\tmp\\nppPluginList.json");
PathAppend(_pluginListFullPath, TEXT("nppPluginList.json"));
#else //RELEASE
#ifdef _WIN64
_pluginListFullPath = TEXT("C:\\sources\\nppPluginList\\vcxproj\\x64\\Debug\\nppPluginList.dll");
#else
_pluginListFullPath = TEXT("C:\\sources\\nppPluginList\\vcxproj\\Debug\\nppPluginList.dll");
#endif
PathAppend(_pluginListFullPath, TEXT("nppPluginList.dll"));
#endif
;
}
generic_string PluginsAdminDlg::getPluginConfigPath() const
{
NppParameters *pNppParameters = NppParameters::getInstance();
generic_string nppPluginsConfDir;
if (pNppParameters->isLocal())
{
nppPluginsConfDir = pNppParameters->getNppPath();
}
else
{
nppPluginsConfDir = pNppParameters->getAppDataNppDir();
}
PathAppend(nppPluginsConfDir, TEXT("plugins"));
PathAppend(nppPluginsConfDir, TEXT("Config"));
if (!::PathFileExists(nppPluginsConfDir.c_str()))
{
::CreateDirectory(nppPluginsConfDir.c_str(), NULL);
}
return nppPluginsConfDir;
}
generic_string PluginsAdminDlg::getPluginsPath() const
{
NppParameters *pNppParameters = NppParameters::getInstance();

View File

@ -183,6 +183,7 @@ public :
bool updateListAndLoadFromJson();
void setAdminMode(bool isAdm) { _nppCurrentStatus._isAdminMode = isAdm; };
generic_string getPluginsPath() const;
generic_string getPluginConfigPath() const;
bool installPlugins();
bool updatePlugins();