From 4b1a13ae2f6b510ec77b73264b098009a5287f5f Mon Sep 17 00:00:00 2001 From: Brandon Turner Date: Sun, 11 Sep 2005 19:40:45 +0000 Subject: [PATCH] Windows style auto complete should only return folders then the preceding command is cd or rd. svn path=/trunk/; revision=17805 --- reactos/subsys/system/cmd/filecomp.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/reactos/subsys/system/cmd/filecomp.c b/reactos/subsys/system/cmd/filecomp.c index 740f396dbc6..7b95cf1cb29 100644 --- a/reactos/subsys/system/cmd/filecomp.c +++ b/reactos/subsys/system/cmd/filecomp.c @@ -541,6 +541,13 @@ VOID CompleteFilename (LPTSTR strIN, BOOL bNext, LPTSTR strOut, INT cusor) static INT Sel; BOOL NeededQuote = FALSE; strOut[0] = _T('\0'); + BOOL ShowAll = TRUE; + + TCHAR * line = strIN; + while (_istspace (*line)) + line++; + if(!_tcsncmp (line, _T("rd "), 3) || !_tcsncmp (line, _T("cd "), 3)) + ShowAll = FALSE; /* Copy the string, str can be edited and orginal should not be */ _tcscpy(str,strIN); @@ -615,6 +622,15 @@ VOID CompleteFilename (LPTSTR strIN, BOOL bNext, LPTSTR strOut, INT cusor) if(!_tcscmp (file.cFileName, _T(".")) || !_tcscmp (file.cFileName, _T(".."))) continue; + + /* Don't show files when they are doing 'cd' or 'rd' */ + if(!ShowAll) + { + DWORD attr = GetFileAttributes (file.cFileName); + if(attr != 0xFFFFFFFF && (!(attr & FILE_ATTRIBUTE_DIRECTORY))) + continue; + } + /* Add the file to the list of files */ if(FileList == NULL) {