diff --git a/PowerEditor/src/MISC/Common/Common.cpp b/PowerEditor/src/MISC/Common/Common.cpp index 134ada74a..52367ff62 100644 --- a/PowerEditor/src/MISC/Common/Common.cpp +++ b/PowerEditor/src/MISC/Common/Common.cpp @@ -1549,6 +1549,9 @@ bool isUnsupportedFileName(const generic_string& fileName) if (pos != std::string::npos) fileNameOnly = fileNameOnly.substr(pos + 1); + // upperize because the std::find is case sensitive unlike the Windows OS filesystem + std::transform(fileNameOnly.begin(), fileNameOnly.end(), fileNameOnly.begin(), ::towupper); + const std::vector reservedWin32NamespaceDeviceList{ TEXT("CON"), TEXT("PRN"), TEXT("AUX"), TEXT("NUL"), TEXT("COM1"), TEXT("COM2"), TEXT("COM3"), TEXT("COM4"), TEXT("COM5"), TEXT("COM6"), TEXT("COM7"), TEXT("COM8"), TEXT("COM9"), diff --git a/PowerEditor/src/NppIO.cpp b/PowerEditor/src/NppIO.cpp index fa65fb7b0..6755249f1 100644 --- a/PowerEditor/src/NppIO.cpp +++ b/PowerEditor/src/NppIO.cpp @@ -126,8 +126,14 @@ DWORD WINAPI Notepad_plus::monitorFileOnChange(void * params) return EXIT_SUCCESS; } -bool resolveLinkFile(generic_string& linkFilePath) +bool resolveLinkFile(std::wstring& linkFilePath) { + // upperize for the following comparison because the ends_with is case sensitive unlike the Windows OS filesystem + std::wstring linkFilePathUp = linkFilePath; + std::transform(linkFilePathUp.begin(), linkFilePathUp.end(), linkFilePathUp.begin(), ::towupper); + if (!linkFilePathUp.ends_with(L".LNK")) + return false; // we will not check the renamed shortcuts like "file.lnk.txt" + bool isResolved = false; IShellLink* psl = nullptr;