cmd: Fix delayed expansion in FOR loop on file sets.

Signed-off-by: Eric Pouech <epouech@codeweavers.com>
This commit is contained in:
Eric Pouech 2024-06-18 10:11:13 +02:00 committed by Alexandre Julliard
parent 0ca28d3a70
commit f98077591f
2 changed files with 8 additions and 3 deletions

View file

@ -610,8 +610,8 @@ N
''
'.eh'@or_broken@''
"foo bar"
@todo_wine@foo
@todo_wine@bar
foo
bar
--- in digit variables
a %1 %2
b %1 %2

View file

@ -3255,6 +3255,7 @@ static CMD_NODE *for_control_execute_set(CMD_FOR_CONTROL *for_ctrl, const WCHAR
len = 0;
wcscpy(set, for_ctrl->set);
handleExpansion(set, context != NULL, delayedsubst);
for (i = 0; ; i++)
{
WCHAR *element = WCMD_parameter(set, i, NULL, TRUE, FALSE);
@ -3314,7 +3315,11 @@ static CMD_NODE *for_control_execute_walk_files(CMD_FOR_CONTROL *for_ctrl, CMD_N
if (for_ctrl->root_dir)
{
dirs_to_walk = WCMD_dir_stack_create(for_ctrl->root_dir, NULL);
WCHAR buffer[MAXSTRING];
wcscpy(buffer, for_ctrl->root_dir);
handleExpansion(buffer, context != NULL, delayedsubst);
dirs_to_walk = WCMD_dir_stack_create(buffer, NULL);
}
else dirs_to_walk = WCMD_dir_stack_create(NULL, NULL);
ref_len = wcslen(dirs_to_walk->dirName);