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:
parent
08b0156472
commit
b9b3faf307
@ -352,6 +352,8 @@ BufferID Notepad_plus::doOpen(const generic_string& fileName, bool isRecursive,
|
|||||||
if (globbing)
|
if (globbing)
|
||||||
{
|
{
|
||||||
const TCHAR * substring = wcsrchr(fileName.c_str(), TCHAR('\\'));
|
const TCHAR * substring = wcsrchr(fileName.c_str(), TCHAR('\\'));
|
||||||
|
if (substring)
|
||||||
|
{
|
||||||
size_t pos = substring - fileName.c_str();
|
size_t pos = substring - fileName.c_str();
|
||||||
|
|
||||||
patterns.push_back(substring + 1);
|
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);
|
getMatchedFileNames(dir.c_str(), patterns, fileNames, isRecursive, false);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
generic_string fileNameStr = fileName;
|
generic_string fileNameStr = fileName;
|
||||||
|
@ -62,7 +62,7 @@ FileDialog::FileDialog(HWND hwnd, HINSTANCE hInst)
|
|||||||
_ofn.lpfnHook = NULL;
|
_ofn.lpfnHook = NULL;
|
||||||
_ofn.lpstrDefExt = NULL; // No default extension
|
_ofn.lpstrDefExt = NULL; // No default extension
|
||||||
_ofn.lCustData = 0;
|
_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.pvReserved = NULL;
|
||||||
_ofn.dwReserved = 0;
|
_ofn.dwReserved = 0;
|
||||||
_ofn.FlagsEx = 0;
|
_ofn.FlagsEx = 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user