If the file is not a directory remove the redundant '\' char in file name string returned from FileHandleGetFileName.
Cc: Jaben Carsey <[email protected]> Cc: Liming Gao <[email protected]> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Qiu Shumin <[email protected]> Reviewed-by: Jaben Carsey <[email protected]> --- MdePkg/Library/UefiFileHandleLib/UefiFileHandleLib.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/MdePkg/Library/UefiFileHandleLib/UefiFileHandleLib.c b/MdePkg/Library/UefiFileHandleLib/UefiFileHandleLib.c index f6cbfad..0bb82be 100644 --- a/MdePkg/Library/UefiFileHandleLib/UefiFileHandleLib.c +++ b/MdePkg/Library/UefiFileHandleLib/UefiFileHandleLib.c @@ -856,6 +856,14 @@ FileHandleGetFileName ( *FullFileName = StrnCatGrowLeft(FullFileName, &Size, L"\\", 0); } + if (*FullFileName != NULL && + (*FullFileName)[StrLen(*FullFileName) - 1] == L'\\' && + StrLen(*FullFileName) > 1 && + FileHandleIsDirectory(Handle) == EFI_NOT_FOUND + ) { + (*FullFileName)[StrLen(*FullFileName) - 1] = CHAR_NULL; + } + if (CurrentHandle != NULL) { CurrentHandle->Close (CurrentHandle); } -- 1.9.5.msysgit.1 _______________________________________________ edk2-devel mailing list [email protected] https://lists.01.org/mailman/listinfo/edk2-devel

