From 49f4d8010ff870efd2d4f0a0c80d9de2fae00f10 Mon Sep 17 00:00:00 2001 From: Martin Fuchs Date: Fri, 17 Sep 2004 16:56:47 +0000 Subject: [PATCH] Handle "." and ".." as special direcory names and move them at the very first beginning of directory listings svn path=/branches/lean-explorer/; revision=10889 --- reactos/subsys/system/explorer/shell/entries.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/reactos/subsys/system/explorer/shell/entries.cpp b/reactos/subsys/system/explorer/shell/entries.cpp index 65714ba9f27..b2e18b3e099 100644 --- a/reactos/subsys/system/explorer/shell/entries.cpp +++ b/reactos/subsys/system/explorer/shell/entries.cpp @@ -168,10 +168,16 @@ Root::~Root() // directories first... static int compareType(const WIN32_FIND_DATA* fd1, const WIN32_FIND_DATA* fd2) { - int dir1 = fd1->dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY; - int dir2 = fd2->dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY; + int order1 = fd1->dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY; + int order2 = fd2->dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY; - return dir2==dir1? 0: dir2cFileName[0]!='.'? 1: fd1->cFileName[1]=='.'? 2: fd1->cFileName[1]=='\0'? 3: 1; + order2 = fd2->cFileName[0]!='.'? 1: fd2->cFileName[1]=='.'? 2: fd2->cFileName[1]=='\0'? 3: 1; + } + + return order2==order1? 0: order2