From 7c81c623fdfd3903757d273d36d5e99a502072a1 Mon Sep 17 00:00:00 2001 From: Don Ho Date: Thu, 3 Nov 2011 02:15:46 +0000 Subject: [PATCH] [ENHANCEMENT] Enhance "Add files from Directory" command in Project Manager: sorted result: first all folders, then all files, both of them alphabetically. git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository/trunk@837 f5eea248-9336-0410-98b8-ebc06183d4e3 --- .../WinControls/ProjectPanel/ProjectPanel.cpp | 20 ++++++++++++------- PowerEditor/visual.net/notepadPlus.vcproj | 4 ++-- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/PowerEditor/src/WinControls/ProjectPanel/ProjectPanel.cpp b/PowerEditor/src/WinControls/ProjectPanel/ProjectPanel.cpp index 4ccf0996a..85f2130f8 100644 --- a/PowerEditor/src/WinControls/ProjectPanel/ProjectPanel.cpp +++ b/PowerEditor/src/WinControls/ProjectPanel/ProjectPanel.cpp @@ -1019,9 +1019,10 @@ void ProjectPanel::recursiveAddFilesFrom(const TCHAR *folderPath, HTREEITEM hTre dirFilter += TEXT("*.*"); WIN32_FIND_DATA foundData; + std::vector files; HANDLE hFile = ::FindFirstFile(dirFilter.c_str(), &foundData); - + do { if (hFile == INVALID_HANDLE_VALUE) break; @@ -1048,14 +1049,19 @@ void ProjectPanel::recursiveAddFilesFrom(const TCHAR *folderPath, HTREEITEM hTre } else { - generic_string pathFile(folderPath); - if (folderPath[lstrlen(folderPath)-1] != '\\') - pathFile += TEXT("\\"); - pathFile += foundData.cFileName; - TCHAR *strValueLabel = ::PathFindFileName(pathFile.c_str()); - _treeView.addItem(strValueLabel, hTreeItem, INDEX_LEAF, pathFile.c_str()); + files.push_back(foundData.cFileName); } } while (::FindNextFile(hFile, &foundData)); + + for (size_t i = 0 ; i < files.size() ; i++) + { + generic_string pathFile(folderPath); + if (folderPath[lstrlen(folderPath)-1] != '\\') + pathFile += TEXT("\\"); + pathFile += files[i]; + _treeView.addItem(files[i].c_str(), hTreeItem, INDEX_LEAF, pathFile.c_str()); + } + ::FindClose(hFile); } diff --git a/PowerEditor/visual.net/notepadPlus.vcproj b/PowerEditor/visual.net/notepadPlus.vcproj index 9f6259ec8..9850005fb 100644 --- a/PowerEditor/visual.net/notepadPlus.vcproj +++ b/PowerEditor/visual.net/notepadPlus.vcproj @@ -1611,11 +1611,11 @@ >