Merge pull request #4816 from akallabeth/drive_cmd_fix

Fix #4680: Return proper directory name.
This commit is contained in:
Martin Fleisz 2018-08-24 09:45:26 +02:00 committed by GitHub
commit 8248dcb3bb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 17 additions and 2 deletions

View File

@ -53,8 +53,8 @@
static void drive_file_fix_path(WCHAR* path)
{
int i;
int length;
size_t i;
size_t length;
length = (int) _wcslen(path);
for (i = 0; i < length; i++)

View File

@ -933,7 +933,22 @@ HANDLE FindFirstFileA(LPCSTR lpFileName, LPWIN32_FIND_DATAA lpFindFileData)
}
if (FindNextFileA((HANDLE) pFileSearch, lpFindFileData))
{
if (isDir)
{
char* name = strrchr(lpFileName, '/');
if (!name)
name = lpFileName;
else
name++;
pFileSearch->lpPattern[0] = '*';
strcpy(lpFindFileData->cFileName, name);
}
return (HANDLE) pFileSearch;
}
FindClose(pFileSearch);
return INVALID_HANDLE_VALUE;