Module: wine Branch: master Commit: 322c175cf0291d5c8543e0662a55082d0e53d001 URL: https://gitlab.winehq.org/wine/wine/-/commit/322c175cf0291d5c8543e0662a55082...
Author: Akihiro Sagawa sagawa.aki@gmail.com Date: Fri Aug 18 12:51:54 2023 +0900
cmd: DIR command outputs free space for the path.
When the path contains a mountpoint on Unix or a junction point to another drive on Windows, cmd.exe should show free space for the path instead of the root of the drive.
---
programs/cmd/directory.c | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-)
diff --git a/programs/cmd/directory.c b/programs/cmd/directory.c index b9b8656fd70..6efcbb3a841 100644 --- a/programs/cmd/directory.c +++ b/programs/cmd/directory.c @@ -503,16 +503,14 @@ static DIRECTORY_STACK *WCMD_list_directory (DIRECTORY_STACK *inputparms, int le /***************************************************************************** * WCMD_dir_trailer * - * Print out the trailer for the supplied drive letter + * Print out the trailer for the supplied path */ -static void WCMD_dir_trailer(WCHAR drive) { - ULARGE_INTEGER avail, total, freebytes; - DWORD status; - WCHAR driveName[] = L"c:\"; - - driveName[0] = drive; - status = GetDiskFreeSpaceExW(driveName, &avail, &total, &freebytes); - WINE_TRACE("Writing trailer for '%s' gave %ld(%ld)\n", wine_dbgstr_w(driveName), +static void WCMD_dir_trailer(const WCHAR *path) { + ULARGE_INTEGER freebytes; + BOOL status; + + status = GetDiskFreeSpaceExW(path, NULL, NULL, &freebytes); + WINE_TRACE("Writing trailer for '%s' gave %d(%ld)\n", wine_dbgstr_w(path), status, GetLastError());
if (errorlevel==0 && !bare) { @@ -828,7 +826,7 @@ void WCMD_directory (WCHAR *args) /* Trailer Information */ if (lastDrive != '?') { trailerReqd = FALSE; - WCMD_dir_trailer(prevEntry->dirName[0]); + WCMD_dir_trailer(prevEntry->dirName); }
lastDrive = towupper(thisEntry->dirName[0]); @@ -858,7 +856,7 @@ void WCMD_directory (WCHAR *args)
/* Trailer Information */ if (trailerReqd) { - WCMD_dir_trailer(prevEntry->dirName[0]); + WCMD_dir_trailer(prevEntry->dirName); }
exit: