Revision: 18314
          http://sourceforge.net/p/edk2/code/18314
Author:   shenshushi
Date:     2015-08-26 02:25:42 +0000 (Wed, 26 Aug 2015)
Log Message:
-----------
MdePkg: Make the FileHandleGetFileName return the file name in right format.

1. If the file is not a directory remove the redundant '\' char in file name 
string returned from UefiFileHandleLib.FileHandleGetFileName.
2. Update function comments.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Qiu Shumin <[email protected]>
Reviewed-by: Jaben Carsey <[email protected]>
Reviewed-by: Liming Gao <[email protected]>

Modified Paths:
--------------
    trunk/edk2/MdePkg/Include/Library/FileHandleLib.h
    trunk/edk2/MdePkg/Library/UefiFileHandleLib/UefiFileHandleLib.c

Modified: trunk/edk2/MdePkg/Include/Library/FileHandleLib.h
===================================================================
--- trunk/edk2/MdePkg/Include/Library/FileHandleLib.h   2015-08-26 01:19:09 UTC 
(rev 18313)
+++ trunk/edk2/MdePkg/Include/Library/FileHandleLib.h   2015-08-26 02:25:42 UTC 
(rev 18314)
@@ -356,7 +356,9 @@
 
 /**
   Function to get a full filename given a EFI_FILE_HANDLE somewhere lower on 
the
-  directory 'stack'.
+  directory 'stack'. If the file is a directory, then append the '\' char at 
the 
+  end of name string. If it's not a directory, then the last '\' should not be 
+  added.
 
   @param[in] Handle             Handle to the Directory or File to create path 
to.
   @param[out] FullFileName      Pointer to pointer to generated full file 
name.  It

Modified: trunk/edk2/MdePkg/Library/UefiFileHandleLib/UefiFileHandleLib.c
===================================================================
--- trunk/edk2/MdePkg/Library/UefiFileHandleLib/UefiFileHandleLib.c     
2015-08-26 01:19:09 UTC (rev 18313)
+++ trunk/edk2/MdePkg/Library/UefiFileHandleLib/UefiFileHandleLib.c     
2015-08-26 02:25:42 UTC (rev 18314)
@@ -769,7 +769,9 @@
 
 /**
   Function to get a full filename given a EFI_FILE_HANDLE somewhere lower on 
the
-  directory 'stack'.
+  directory 'stack'. If the file is a directory, then append the '\' char at 
the 
+  end of name string. If it's not a directory, then the last '\' should not be 
+  added.
 
   if Handle is NULL, return EFI_INVALID_PARAMETER
 
@@ -856,6 +858,14 @@
     *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);
   }


------------------------------------------------------------------------------
_______________________________________________
edk2-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-commits

Reply via email to