Fix crash issue due to Unix style path input in Open file dialog.

This issue occurs when "Use New Style Dialog" setting is not used .
Ctrl+O, then type D:/*.log and hit Enter.

Fix #4946, close #4986
This commit is contained in:
Rajendra Singh 2018-11-04 11:40:29 +05:30 committed by Don HO
parent 08b0156472
commit b9b3faf307
2 changed files with 11 additions and 8 deletions

View File

@ -352,6 +352,8 @@ BufferID Notepad_plus::doOpen(const generic_string& fileName, bool isRecursive,
if (globbing)
{
const TCHAR * substring = wcsrchr(fileName.c_str(), TCHAR('\\'));
if (substring)
{
size_t pos = substring - fileName.c_str();
patterns.push_back(substring + 1);
@ -362,6 +364,7 @@ BufferID Notepad_plus::doOpen(const generic_string& fileName, bool isRecursive,
getMatchedFileNames(dir.c_str(), patterns, fileNames, isRecursive, false);
}
}
else
{
generic_string fileNameStr = fileName;

View File

@ -62,7 +62,7 @@ FileDialog::FileDialog(HWND hwnd, HINSTANCE hInst)
_ofn.lpfnHook = NULL;
_ofn.lpstrDefExt = NULL; // No default extension
_ofn.lCustData = 0;
_ofn.Flags = OFN_PATHMUSTEXIST | OFN_EXPLORER | OFN_LONGNAMES | DS_CENTER | OFN_HIDEREADONLY;
_ofn.Flags = OFN_PATHMUSTEXIST | OFN_EXPLORER | OFN_LONGNAMES | OFN_HIDEREADONLY;
_ofn.pvReserved = NULL;
_ofn.dwReserved = 0;
_ofn.FlagsEx = 0;