diff --git a/PowerEditor/src/MISC/Common/Common.cpp b/PowerEditor/src/MISC/Common/Common.cpp index 4a5d3fe54..1ee0a4f9a 100644 --- a/PowerEditor/src/MISC/Common/Common.cpp +++ b/PowerEditor/src/MISC/Common/Common.cpp @@ -950,7 +950,7 @@ bool str2Clipboard(const generic_string &str2cpy, HWND hwnd) return true; } -bool buf2Clipborad(const std::vector& buffers, bool isFullPath, HWND hwnd) +bool buf2Clipboard(const std::vector& buffers, bool isFullPath, HWND hwnd) { const generic_string crlf = _T("\r\n"); generic_string selection; @@ -1342,21 +1342,19 @@ void getFilesInFolder(std::vector& files, const generic_string& WIN32_FIND_DATA foundData; HANDLE hFindFile = ::FindFirstFile(filter.c_str(), &foundData); - - if (hFindFile != INVALID_HANDLE_VALUE && !(foundData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)) + if (hFindFile != INVALID_HANDLE_VALUE) { - generic_string foundFullPath = inFolder; - pathAppend(foundFullPath, foundData.cFileName); - files.push_back(foundFullPath); - - while (::FindNextFile(hFindFile, &foundData)) + do { - generic_string foundFullPath2 = inFolder; - pathAppend(foundFullPath2, foundData.cFileName); - files.push_back(foundFullPath2); - } + if (!(foundData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)) + { + generic_string foundFullPath = inFolder; + pathAppend(foundFullPath, foundData.cFileName); + files.push_back(foundFullPath); + } + } while (::FindNextFile(hFindFile, &foundData)); + ::FindClose(hFindFile); } - ::FindClose(hFindFile); } // remove any leading or trailing spaces from str diff --git a/PowerEditor/src/MISC/Common/Common.h b/PowerEditor/src/MISC/Common/Common.h index 88c68307e..d89a58cbe 100644 --- a/PowerEditor/src/MISC/Common/Common.h +++ b/PowerEditor/src/MISC/Common/Common.h @@ -167,7 +167,7 @@ int OrdinalIgnoreCaseCompareStrings(LPCTSTR sz1, LPCTSTR sz2); bool str2Clipboard(const generic_string &str2cpy, HWND hwnd); class Buffer; -bool buf2Clipborad(const std::vector& buffers, bool isFullPath, HWND hwnd); +bool buf2Clipboard(const std::vector& buffers, bool isFullPath, HWND hwnd); generic_string GetLastErrorAsString(DWORD errorCode = 0); diff --git a/PowerEditor/src/MISC/PluginsManager/Notepad_plus_msgs.h b/PowerEditor/src/MISC/PluginsManager/Notepad_plus_msgs.h index 50bac2e0f..e273cab3b 100644 --- a/PowerEditor/src/MISC/PluginsManager/Notepad_plus_msgs.h +++ b/PowerEditor/src/MISC/PluginsManager/Notepad_plus_msgs.h @@ -285,7 +285,7 @@ enum Platform { PF_UNKNOWN, PF_X86, PF_X64, PF_IA64, PF_ARM64 }; #define NPPM_RELOADFILE (NPPMSG + 36) // BOOL NPPM_RELOADFILE(BOOL withAlert, TCHAR *filePathName2Reload) - // Reload the document which matches with the given filePathName2switch. + // Reload the document which matches with the given filePathName2Reload. // wParam: 0 (not used) // lParam[in]: filePathName2Reload is the full file path of document to reload // Return TRUE if reloading file succeeds, otherwise FALSE diff --git a/PowerEditor/src/Notepad_plus.cpp b/PowerEditor/src/Notepad_plus.cpp index 9eb783a44..3c1af9ca8 100644 --- a/PowerEditor/src/Notepad_plus.cpp +++ b/PowerEditor/src/Notepad_plus.cpp @@ -1821,74 +1821,47 @@ void Notepad_plus::removeDuplicateLines() void Notepad_plus::getMatchedFileNames(const TCHAR *dir, size_t level, const vector & patterns, vector & fileNames, bool isRecursive, bool isInHiddenDir) { level++; + generic_string dirFilter(dir); dirFilter += TEXT("*.*"); + WIN32_FIND_DATA foundData; - - HANDLE hFile = ::FindFirstFile(dirFilter.c_str(), &foundData); - - if (hFile != INVALID_HANDLE_VALUE) + HANDLE hFindFile = ::FindFirstFile(dirFilter.c_str(), &foundData); + if (hFindFile != INVALID_HANDLE_VALUE) { - - if (foundData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) + do { - if (!isInHiddenDir && (foundData.dwFileAttributes & FILE_ATTRIBUTE_HIDDEN)) + if (foundData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) { - // do nothing - } - else if (isRecursive) - { - if ((OrdinalIgnoreCaseCompareStrings(foundData.cFileName, TEXT(".")) != 0) && (OrdinalIgnoreCaseCompareStrings(foundData.cFileName, TEXT("..")) != 0) && - !matchInExcludeDirList(foundData.cFileName, patterns, level)) + if (!isInHiddenDir && (foundData.dwFileAttributes & FILE_ATTRIBUTE_HIDDEN)) { - generic_string pathDir(dir); - pathDir += foundData.cFileName; - pathDir += TEXT("\\"); - getMatchedFileNames(pathDir.c_str(), level, patterns, fileNames, isRecursive, isInHiddenDir); + // do nothing + } + else if (isRecursive) + { + if ((OrdinalIgnoreCaseCompareStrings(foundData.cFileName, TEXT(".")) != 0) && + (OrdinalIgnoreCaseCompareStrings(foundData.cFileName, TEXT("..")) != 0) && + !matchInExcludeDirList(foundData.cFileName, patterns, level)) + { + generic_string pathDir(dir); + pathDir += foundData.cFileName; + pathDir += TEXT("\\"); + getMatchedFileNames(pathDir.c_str(), level, patterns, fileNames, isRecursive, isInHiddenDir); + } } } - } - else - { - if (matchInList(foundData.cFileName, patterns)) + else { - generic_string pathFile(dir); - pathFile += foundData.cFileName; - fileNames.push_back(pathFile.c_str()); - } - } - } - while (::FindNextFile(hFile, &foundData)) - { - if (foundData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) - { - if (!isInHiddenDir && (foundData.dwFileAttributes & FILE_ATTRIBUTE_HIDDEN)) - { - // do nothing - } - else if (isRecursive) - { - if ((OrdinalIgnoreCaseCompareStrings(foundData.cFileName, TEXT(".")) != 0) && (OrdinalIgnoreCaseCompareStrings(foundData.cFileName, TEXT("..")) != 0) && - !matchInExcludeDirList(foundData.cFileName, patterns, level)) + if (matchInList(foundData.cFileName, patterns)) { - generic_string pathDir(dir); - pathDir += foundData.cFileName; - pathDir += TEXT("\\"); - getMatchedFileNames(pathDir.c_str(), level, patterns, fileNames, isRecursive, isInHiddenDir); + generic_string pathFile(dir); + pathFile += foundData.cFileName; + fileNames.push_back(pathFile.c_str()); } } - } - else - { - if (matchInList(foundData.cFileName, patterns)) - { - generic_string pathFile(dir); - pathFile += foundData.cFileName; - fileNames.push_back(pathFile.c_str()); - } - } + } while (::FindNextFile(hFindFile, &foundData)); + ::FindClose(hFindFile); } - ::FindClose(hFile); } bool Notepad_plus::createFilelistForFiles(vector & fileNames) diff --git a/PowerEditor/src/NppCommands.cpp b/PowerEditor/src/NppCommands.cpp index 7a0abb6f9..cbad5bf94 100644 --- a/PowerEditor/src/NppCommands.cpp +++ b/PowerEditor/src/NppCommands.cpp @@ -255,7 +255,7 @@ void Notepad_plus::command(int id) auto files = _pDocumentListPanel->getSelectedFiles(false); for (auto&& sel : files) buffers.push_back(MainFileManager.getBufferByID(sel._bufID)); - buf2Clipborad(buffers, id == IDM_DOCLIST_COPYPATHS, _pDocumentListPanel->getHSelf()); + buf2Clipboard(buffers, id == IDM_DOCLIST_COPYPATHS, _pDocumentListPanel->getHSelf()); } break; @@ -1289,7 +1289,7 @@ void Notepad_plus::command(int id) buffers.push_back(buf); } } - buf2Clipborad({ buffers.begin(), buffers.end() }, id == IDM_EDIT_COPY_ALL_PATHS, _pPublicInterface->getHSelf()); + buf2Clipboard({ buffers.begin(), buffers.end() }, id == IDM_EDIT_COPY_ALL_PATHS, _pPublicInterface->getHSelf()); } break; diff --git a/PowerEditor/src/WinControls/FileBrowser/fileBrowser.cpp b/PowerEditor/src/WinControls/FileBrowser/fileBrowser.cpp index caebc264f..eb880ea27 100644 --- a/PowerEditor/src/WinControls/FileBrowser/fileBrowser.cpp +++ b/PowerEditor/src/WinControls/FileBrowser/fileBrowser.cpp @@ -884,75 +884,44 @@ void FileBrowser::getDirectoryStructure(const TCHAR *dir, const std::vector= 0); - buf2Clipborad(buffers, isFullPath, _hList); + buf2Clipboard(buffers, isFullPath, _hList); } Buffer* WindowsDlg::getBuffer(int index) const