Skip to content

Commit

Permalink
[ENHANCEMENT] Enhance "Add files from Directory" command in Project M…
Browse files Browse the repository at this point in the history
…anager: sorted result: first all folders, then all files, both of them alphabetically.

- Notepad-plus svn trunk @ 837
  • Loading branch information
donho committed Nov 3, 2011
1 parent 541e5a8 commit 8a69315
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 8 deletions.
18 changes: 12 additions & 6 deletions PowerEditor/src/WinControls/ProjectPanel/ProjectPanel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1019,6 +1019,7 @@ void ProjectPanel::recursiveAddFilesFrom(const TCHAR *folderPath, HTREEITEM hTre

dirFilter += TEXT("*.*");
WIN32_FIND_DATA foundData;
std::vector<generic_string> files;

HANDLE hFile = ::FindFirstFile(dirFilter.c_str(), &foundData);

Expand Down Expand Up @@ -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);
}

Expand Down
4 changes: 2 additions & 2 deletions PowerEditor/visual.net/notepadPlus.vcproj
Original file line number Diff line number Diff line change
Expand Up @@ -1611,11 +1611,11 @@
>
</File>
<File
RelativePath="..\src\WinControls\Preference\resource.h"
RelativePath="..\src\resource.h"
>
</File>
<File
RelativePath="..\src\resource.h"
RelativePath="..\src\WinControls\Preference\resource.h"
>
</File>
<File
Expand Down

0 comments on commit 8a69315

Please sign in to comment.