Fix the plugin crash issue due to the inexistent path

Inexistent path %APPDATA%\Notepad++\plugins\Config\ made some plugins crash.
In this PR the folder is checked (and created if it doesn't exist) by each launch of Notepad++.
This commit is contained in:
Don HO 2018-12-17 10:16:01 +01:00
parent 647651b7ee
commit a079013c22

View File

@ -1028,13 +1028,18 @@ bool NppParameters::load()
_userPath = getSpecialFolderLocation(CSIDL_APPDATA); _userPath = getSpecialFolderLocation(CSIDL_APPDATA);
PathAppend(_userPath, TEXT("Notepad++")); PathAppend(_userPath, TEXT("Notepad++"));
_appdataNppDir = _userPluginConfDir = _userPath;
PathAppend(_userPluginConfDir, TEXT("plugins"));
PathAppend(_userPluginConfDir, TEXT("Config"));
if (!PathFileExists(_userPath.c_str())) if (!PathFileExists(_userPath.c_str()))
::CreateDirectory(_userPath.c_str(), NULL); ::CreateDirectory(_userPath.c_str(), NULL);
_appdataNppDir = _userPluginConfDir = _userPath;
PathAppend(_userPluginConfDir, TEXT("plugins"));
if (!PathFileExists(_userPluginConfDir.c_str()))
::CreateDirectory(_userPluginConfDir.c_str(), NULL);
PathAppend(_userPluginConfDir, TEXT("Config"));
if (!PathFileExists(_userPluginConfDir.c_str()))
::CreateDirectory(_userPluginConfDir.c_str(), NULL);
_pluginRootDir = getSpecialFolderLocation(CSIDL_COMMON_APPDATA); _pluginRootDir = getSpecialFolderLocation(CSIDL_COMMON_APPDATA);
PathAppend(_pluginRootDir, TEXT("Notepad++")); PathAppend(_pluginRootDir, TEXT("Notepad++"));
nppPluginRootParent = _pluginRootDir; nppPluginRootParent = _pluginRootDir;