cmd.exe: for loop by default only matches files.

This commit is contained in:
Jason Edmeades 2007-06-15 20:59:29 +01:00 committed by Alexandre Julliard
parent 54d890ca1e
commit 196fb10c32
1 changed files with 10 additions and 4 deletions

View File

@ -593,6 +593,7 @@ void WCMD_for (WCHAR *p, CMD_LIST **cmdList) {
WCHAR variable[4]; WCHAR variable[4];
WCHAR *firstCmd; WCHAR *firstCmd;
int thisDepth; int thisDepth;
BOOL isDirs = FALSE;
/* Check: /* Check:
the first line includes the % variable name as first parm the first line includes the % variable name as first parm
@ -667,10 +668,15 @@ void WCMD_for (WCHAR *p, CMD_LIST **cmdList) {
hff = FindFirstFile (item, &fd); hff = FindFirstFile (item, &fd);
if (hff != INVALID_HANDLE_VALUE) { if (hff != INVALID_HANDLE_VALUE) {
do { do {
thisCmdStart = cmdStart; BOOL isDirectory = (fd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY);
WINE_TRACE("Processing FOR filename %s\n", wine_dbgstr_w(fd.cFileName)); if ((isDirs && isDirectory) ||
WCMD_part_execute (&thisCmdStart, firstCmd, variable, (!isDirs && !isDirectory))
fd.cFileName, FALSE, TRUE); {
thisCmdStart = cmdStart;
WINE_TRACE("Processing FOR filename %s\n", wine_dbgstr_w(fd.cFileName));
WCMD_part_execute (&thisCmdStart, firstCmd, variable,
fd.cFileName, FALSE, TRUE);
}
} while (FindNextFile(hff, &fd) != 0); } while (FindNextFile(hff, &fd) != 0);
FindClose (hff); FindClose (hff);