[PATCH 0/1] MR8200: cmd: COPY should output file names as they are copied.
In native Windows, the COPY command will display the names of the files as they are copied. Wine should do the same. This change enables that. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/8200
From: Joe Souza <jsouza(a)yahoo.com> --- programs/cmd/builtins.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/programs/cmd/builtins.c b/programs/cmd/builtins.c index b78ae9d293b..d218d280f78 100644 --- a/programs/cmd/builtins.c +++ b/programs/cmd/builtins.c @@ -656,6 +656,7 @@ RETURN_CODE WCMD_copy(WCHAR * args) WCHAR copycmd[4]; DWORD len; BOOL dstisdevice = FALSE; + unsigned numcopied = 0; typedef struct _COPY_FILES { @@ -1097,6 +1098,9 @@ RETURN_CODE WCMD_copy(WCHAR * args) return_code = ERROR_INVALID_FUNCTION; } else { WINE_TRACE("Copied successfully\n"); + WCMD_output_asis(srcpath); + WCMD_output_asis(L"\r\n"); + numcopied++; if (anyconcats) writtenoneconcat = TRUE; /* Append EOF if ascii destination and we are not going to add more onto the end @@ -1114,7 +1118,14 @@ RETURN_CODE WCMD_copy(WCHAR * args) return_code = ERROR_INVALID_FUNCTION; } } while (!srcisdevice && FindNextFileW(hff, &fd) != 0); - if (!srcisdevice) FindClose (hff); + if (!srcisdevice) { + FindClose (hff); + if (numcopied) { + WCHAR string[64]; + swprintf(string, ARRAY_SIZE(string), L"\t%u file(s) copied\r\n", numcopied); + WCMD_output_asis(string); + } + } } else { /* Error if the first file was not found */ if (!anyconcats || !writtenoneconcat) { -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/8200
quick testing on Win10 shows that printing of filenames doesn't always occur (eg 'copy a b' doesn't print 'a', while 'copy a* b' does) so some non regression tests could be useful (eg amend existing test to grab copy output to stdout and for example count number of lines, or check if a given filename is present in output) -- https://gitlab.winehq.org/wine/wine/-/merge_requests/8200#note_105317
participants (3)
-
eric pouech (@epo) -
Joe Souza -
Joe Souza (@JoeS209)