summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--MdePkg/Include/Library/BaseLib.h3
-rw-r--r--MdePkg/Library/BaseLib/FilePaths.c9
2 files changed, 6 insertions, 6 deletions
diff --git a/MdePkg/Include/Library/BaseLib.h b/MdePkg/Include/Library/BaseLib.h
index 6268e6fe46..b69c7038e4 100644
--- a/MdePkg/Include/Library/BaseLib.h
+++ b/MdePkg/Include/Library/BaseLib.h
@@ -1747,8 +1747,7 @@ BcdToDecimal8 (
//
/**
- Removes the last directory or file entry in a path by changing the last
- L'\' to a CHAR_NULL.
+ Removes the last directory or file entry in a path.
@param[in, out] Path The pointer to the path to modify.
diff --git a/MdePkg/Library/BaseLib/FilePaths.c b/MdePkg/Library/BaseLib/FilePaths.c
index 183b3234d3..29a84ea902 100644
--- a/MdePkg/Library/BaseLib/FilePaths.c
+++ b/MdePkg/Library/BaseLib/FilePaths.c
@@ -14,9 +14,8 @@
#include <Library/BaseLib.h>
/**
- Removes the last directory or file entry in a path by changing the last
- L'\' to a CHAR_NULL. For a path which is like L"fs0:startup.nsh",
- it's converted to L"fs0:".
+ Removes the last directory or file entry in a path. For a path which is
+ like L"fs0:startup.nsh", it's converted to L"fs0:".
@param[in,out] Path A pointer to the path to modify.
@@ -38,7 +37,9 @@ PathRemoveLastItem(
; Walker != NULL && *Walker != CHAR_NULL
; Walker++
){
- if ((*Walker == L'\\' || *Walker == L':') && *(Walker + 1) != CHAR_NULL) {
+ if (*Walker == L'\\' && *(Walker + 1) != CHAR_NULL) {
+ LastSlash = Walker+1;
+ } else if (*Walker == L':' && *(Walker + 1) != L'\\' && *(Walker + 1) != CHAR_NULL) {
LastSlash = Walker+1;
}
}