Commit 322c175c authored by Akihiro Sagawa's avatar Akihiro Sagawa Committed by Alexandre Julliard

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.
parent 91de94ab
...@@ -503,16 +503,14 @@ static DIRECTORY_STACK *WCMD_list_directory (DIRECTORY_STACK *inputparms, int le ...@@ -503,16 +503,14 @@ static DIRECTORY_STACK *WCMD_list_directory (DIRECTORY_STACK *inputparms, int le
/***************************************************************************** /*****************************************************************************
* WCMD_dir_trailer * 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) { static void WCMD_dir_trailer(const WCHAR *path) {
ULARGE_INTEGER avail, total, freebytes; ULARGE_INTEGER freebytes;
DWORD status; BOOL status;
WCHAR driveName[] = L"c:\\";
status = GetDiskFreeSpaceExW(path, NULL, NULL, &freebytes);
driveName[0] = drive; WINE_TRACE("Writing trailer for '%s' gave %d(%ld)\n", wine_dbgstr_w(path),
status = GetDiskFreeSpaceExW(driveName, &avail, &total, &freebytes);
WINE_TRACE("Writing trailer for '%s' gave %ld(%ld)\n", wine_dbgstr_w(driveName),
status, GetLastError()); status, GetLastError());
if (errorlevel==0 && !bare) { if (errorlevel==0 && !bare) {
...@@ -828,7 +826,7 @@ void WCMD_directory (WCHAR *args) ...@@ -828,7 +826,7 @@ void WCMD_directory (WCHAR *args)
/* Trailer Information */ /* Trailer Information */
if (lastDrive != '?') { if (lastDrive != '?') {
trailerReqd = FALSE; trailerReqd = FALSE;
WCMD_dir_trailer(prevEntry->dirName[0]); WCMD_dir_trailer(prevEntry->dirName);
} }
lastDrive = towupper(thisEntry->dirName[0]); lastDrive = towupper(thisEntry->dirName[0]);
...@@ -858,7 +856,7 @@ void WCMD_directory (WCHAR *args) ...@@ -858,7 +856,7 @@ void WCMD_directory (WCHAR *args)
/* Trailer Information */ /* Trailer Information */
if (trailerReqd) { if (trailerReqd) {
WCMD_dir_trailer(prevEntry->dirName[0]); WCMD_dir_trailer(prevEntry->dirName);
} }
exit: exit:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment