We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Currently it doesn't work for using Notepad2 as external tool for Cppcheck (see wiki https://github.com/zufuliu/notepad2/wiki/Command-Line-Switches#cppcheck). Enable argument dump in ParseCommandLine() shows following arguments are parsed by Cppcheck (note the double slashes):
ParseCommandLine()
-g 4610 D:\\notepad2\\scite\\src\\SciTEBase.cxx
In EnumWndProc2() the passed file path is compared against final path name (GetFinalPathNameByHandle() in EditLoadFile()), which is then diffs.
EnumWndProc2()
GetFinalPathNameByHandle()
EditLoadFile()
Following is a quick fix for ActivatePrevInst():
ActivatePrevInst()
diff --git a/src/Notepad2.c b/src/Notepad2.c index f3550510..e4564d74 100644 --- a/src/Notepad2.c +++ b/src/Notepad2.c @@ -7769,6 +7769,11 @@ BOOL ActivatePrevInst(void) { } GetLongPathNameEx(lpFileArg, MAX_PATH); + { + WCHAR tchTmp[MAX_PATH]; + GetFullPathName(lpFileArg, MAX_PATH, tchTmp, NULL); + lstrcpy(lpFileArg, tchTmp); + } HWND hwnd = NULL; EnumWindows(EnumWndProc2, (LPARAM)&hwnd);
There maybe other cases where the name diffs, a better solution is needed, possible just open the file and get the final path.
The text was updated successfully, but these errors were encountered:
GetFullPathName() does not fix \\?\ prefixed path (see https://docs.microsoft.com/en-us/windows/win32/fileio/naming-a-file#win32-file-namespaces).
\\?\
Sorry, something went wrong.
Based on https://stackoverflow.com/questions/562701/best-way-to-determine-if-two-path-reference-to-same-file-in-windows (and similar questions), we need to use GetFileInformationByHandle() (or GetFileInformationByHandleEx() for Win8+), which is how C++20's std::filesystem::equivalent() is implemented (see https://github.com/microsoft/STL/blob/main/stl/src/filesys.cpp#L329).
GetFileInformationByHandle()
GetFileInformationByHandleEx()
std::filesystem::equivalent()
Fix single file instance failure when path name diffs, issue #378.
2c3b8d6
Fixed by 2c3b8d6. Cppcheck bug reported to https://sourceforge.net/p/cppcheck/discussion/general/thread/b548fc603b/.
No branches or pull requests
Currently it doesn't work for using Notepad2 as external tool for Cppcheck (see wiki https://github.com/zufuliu/notepad2/wiki/Command-Line-Switches#cppcheck). Enable argument dump in
ParseCommandLine()
shows following arguments are parsed by Cppcheck (note the double slashes):In
EnumWndProc2()
the passed file path is compared against final path name (GetFinalPathNameByHandle()
inEditLoadFile()
), which is then diffs.Following is a quick fix for
ActivatePrevInst()
:There maybe other cases where the name diffs, a better solution is needed, possible just open the file and get the final path.
The text was updated successfully, but these errors were encountered: