mirror of
https://github.com/reactos/reactos.git
synced 2024-12-30 19:14:31 +00:00
Handle "." and ".." as special direcory names and move them at the very first beginning of directory listings
svn path=/trunk/; revision=10888
This commit is contained in:
parent
1c08e25544
commit
25547e2d8c
4 changed files with 27 additions and 16 deletions
|
@ -534,8 +534,10 @@ void explorer_show_frame(int cmdshow, LPTSTR lpCmdLine)
|
|||
|
||||
g_Globals._prescan_nodes = false;
|
||||
|
||||
bool mdi = true; //@@
|
||||
|
||||
// create main window
|
||||
MainFrameBase::Create(lpCmdLine, true, cmdshow);
|
||||
MainFrameBase::Create(lpCmdLine, mdi, cmdshow);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -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: dir2<dir1? -1: 1;
|
||||
/* Handle "." and ".." as special case and move them at the very first beginning. */
|
||||
if (order1 && order2) {
|
||||
order1 = fd1->cFileName[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<order1? -1: 1;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -163,15 +163,6 @@ MainFrameBase::MainFrameBase(HWND hwnd)
|
|||
#ifdef _NO_REBAR
|
||||
{0, 0, 0, BTNS_SEP, {0, 0}, 0, 0},
|
||||
#endif
|
||||
{0, ID_WINDOW_NEW, TBSTATE_ENABLED, BTNS_BUTTON, {0, 0}, 0, 0},
|
||||
{1, ID_WINDOW_CASCADE, TBSTATE_ENABLED, BTNS_BUTTON, {0, 0}, 0, 0},
|
||||
{2, ID_WINDOW_TILE_HORZ, TBSTATE_ENABLED, BTNS_BUTTON, {0, 0}, 0, 0},
|
||||
{3, ID_WINDOW_TILE_VERT, TBSTATE_ENABLED, BTNS_BUTTON, {0, 0}, 0, 0},
|
||||
/*TODO
|
||||
{4, ID_... , TBSTATE_ENABLED, BTNS_BUTTON, {0, 0}, 0, 0},
|
||||
{5, ID_... , TBSTATE_ENABLED, BTNS_BUTTON, {0, 0}, 0, 0},
|
||||
*/
|
||||
{0, 0, 0, BTNS_SEP, {0, 0}, 0, 0},
|
||||
{7, ID_GO_BACK, TBSTATE_ENABLED, BTNS_BUTTON, {0, 0}, 0, 0},
|
||||
{8, ID_GO_FORWARD, TBSTATE_ENABLED, BTNS_BUTTON, {0, 0}, 0, 0},
|
||||
{9, ID_GO_UP, TBSTATE_ENABLED, BTNS_BUTTON, {0, 0}, 0, 0},
|
||||
|
@ -179,6 +170,12 @@ MainFrameBase::MainFrameBase(HWND hwnd)
|
|||
{11, ID_GO_SEARCH, TBSTATE_ENABLED, BTNS_BUTTON, {0, 0}, 0, 0},
|
||||
{12, ID_REFRESH, TBSTATE_ENABLED, BTNS_BUTTON, {0, 0}, 0, 0},
|
||||
{13, ID_STOP, TBSTATE_ENABLED, BTNS_BUTTON, {0, 0}, 0, 0},
|
||||
/* {0, 0, 0, BTNS_SEP, {0, 0}, 0, 0},
|
||||
{0, ID_WINDOW_NEW, TBSTATE_ENABLED, BTNS_BUTTON, {0, 0}, 0, 0},
|
||||
{1, ID_WINDOW_CASCADE, TBSTATE_ENABLED, BTNS_BUTTON, {0, 0}, 0, 0},
|
||||
{2, ID_WINDOW_TILE_HORZ, TBSTATE_ENABLED, BTNS_BUTTON, {0, 0}, 0, 0},
|
||||
{3, ID_WINDOW_TILE_VERT, TBSTATE_ENABLED, BTNS_BUTTON, {0, 0}, 0, 0},
|
||||
*/
|
||||
};
|
||||
|
||||
_htoolbar = CreateToolbarEx(hwnd,
|
||||
|
|
|
@ -973,10 +973,16 @@ static void read_directory_shell(Entry* dir, HWND hwnd)
|
|||
/* 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: dir2<dir1? -1: 1;
|
||||
/* Handle "." and ".." as special case and move them at the very first beginning. */
|
||||
if (order1 && order2) {
|
||||
order1 = fd1->cFileName[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<order1? -1: 1;
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue