I am quite happy to make some change to this library if Jaben agrees with
this change. But this patch only moves the existing BasePathLib from one
package to another one.

Olivier

> -----Original Message-----
> From: Ni, Ruiyu [mailto:ruiyu...@intel.com]
> Sent: 15 August 2014 06:23
> To: edk2-devel@lists.sourceforge.net; Tian, Feng; Olivier Martin
> Cc: Brendan Jackman
> Subject: RE: [edk2] [PATCH 1/3] Move BasePathLib from ShellPkg to
> MdeModulePkg
> 
> I think maybe PathCleanUpDirectories is not a good name to describe
> this API's behavior. It's a API to normalize the file path but do
> nothing to the directory content. Would "PathNormalize" be better?
> 
> -----Original Message-----
> From: Carsey, Jaben [mailto:jaben.car...@intel.com]
> Sent: Friday, August 15, 2014 4:41 AM
> To: edk2-devel@lists.sourceforge.net; Tian, Feng; Olivier Martin
> (olivier.mar...@arm.com)
> Cc: Brendan Jackman
> Subject: Re: [edk2] [PATCH 1/3] Move BasePathLib from ShellPkg to
> MdeModulePkg
> 
> Reviewed-by: Jaben Carsey <jaben.car...@intel.com>
> 
> I didn't notice this email originally. I think that this looks like a
> good change.  What other feedback are you hoping for?
> 
> -Jaben
> 
> 
> > -----Original Message-----
> > From: Olivier Martin [mailto:olivier.mar...@arm.com]
> > Sent: Thursday, August 14, 2014 12:06 PM
> > To: edk2-devel@lists.sourceforge.net; Tian, Feng
> > Cc: Brendan Jackman
> > Subject: Re: [edk2] [PATCH 1/3] Move BasePathLib from ShellPkg to
> > MdeModulePkg
> >
> > Any feedback on this one?
> >
> > Thanks,
> > Olivier
> >
> > > -----Original Message-----
> > > From: Olivier Martin [mailto:olivier.mar...@arm.com]
> > > Sent: 24 March 2014 20:23
> > > To: feng.t...@intel.com
> > > Cc: Brendan Jackman; edk2-devel@lists.sourceforge.net
> > > Subject: [edk2] [PATCH 1/3] Move BasePathLib from ShellPkg to
> > > MdeModulePkg
> > >
> > > From: Brendan Jackman <brendan.jack...@arm.com>
> > >
> > > This library is useful to other modules than the shell - for
> example
> > > filesystem drivers.
> > >
> > > Contributed-under: TianoCore Contribution Agreement 1.0
> > > Signed-off-by: Brendan Jackman <brendan.jack...@arm.com>
> > > Reviewed-by: Olivier Martin <olivier.mar...@arm.com>
> > > ---
> > >  AppPkg/AppPkg.dsc                                |   2 +-
> > >  EmulatorPkg/EmulatorPkg.dsc                      |   2 +-
> > >  MdeModulePkg/Include/Library/PathLib.h           |  56 +++++++++++
> > >  MdeModulePkg/Library/BasePathLib/BasePathLib.c   | 123
> > > +++++++++++++++++++++++
> > >  MdeModulePkg/Library/BasePathLib/BasePathLib.inf |  38 +++++++
> > >  OvmfPkg/OvmfPkgIa32.dsc                          |   2 +-
> > >  OvmfPkg/OvmfPkgIa32X64.dsc                       |   2 +-
> > >  OvmfPkg/OvmfPkgX64.dsc                           |   2 +-
> > >  ShellPkg/Include/Library/PathLib.h               |  56 -----------
> > >  ShellPkg/Library/BasePathLib/BasePathLib.c       | 123 -----------
> ----
> > > --------
> > >  ShellPkg/Library/BasePathLib/BasePathLib.inf     |  38 -------
> > >  ShellPkg/ShellPkg.dsc                            |   2 +-
> > >  StdLib/StdLib.dsc                                |   2 +-
> > >  StdLib/StdLib.inc                                |   2 +-
> > >  14 files changed, 225 insertions(+), 225 deletions(-)  create mode
> > > 100644 MdeModulePkg/Include/Library/PathLib.h
> > >  create mode 100644 MdeModulePkg/Library/BasePathLib/BasePathLib.c
> > >  create mode 100644
> MdeModulePkg/Library/BasePathLib/BasePathLib.inf
> > >  delete mode 100644 ShellPkg/Include/Library/PathLib.h
> > >  delete mode 100644 ShellPkg/Library/BasePathLib/BasePathLib.c
> > >  delete mode 100644 ShellPkg/Library/BasePathLib/BasePathLib.inf
> > >
> > > diff --git a/AppPkg/AppPkg.dsc b/AppPkg/AppPkg.dsc index
> > > d0aac2c..491332a 100644
> > > --- a/AppPkg/AppPkg.dsc
> > > +++ b/AppPkg/AppPkg.dsc
> > > @@ -82,7 +82,7 @@
> > >    ShellLib|ShellPkg/Library/UefiShellLib/UefiShellLib.inf
> > >
> > >
> FileHandleLib|ShellPkg/Library/UefiFileHandleLib/UefiFileHandleLib.inf
> > >    SortLib|ShellPkg/Library/UefiSortLib/UefiSortLib.inf
> > > -  PathLib|ShellPkg/Library/BasePathLib/BasePathLib.inf
> > > +  PathLib|MdeModulePkg/Library/BasePathLib/BasePathLib.inf
> > >
> > >
> > >
> > CacheMaintenanceLib|MdePkg/Library/BaseCacheMaintenanceLib/BaseCac
> > heMa
> > > CacheMaintenanceLib|i
> > > ntenanceLib.inf
> > >
> > > diff --git a/EmulatorPkg/EmulatorPkg.dsc
> b/EmulatorPkg/EmulatorPkg.dsc
> > > index f1cb780..fb580d6 100644
> > > --- a/EmulatorPkg/EmulatorPkg.dsc
> > > +++ b/EmulatorPkg/EmulatorPkg.dsc
> > > @@ -391,7 +391,7 @@
> > >        ShellLib|ShellPkg/Library/UefiShellLib/UefiShellLib.inf
> > >        SortLib|ShellPkg/Library/UefiSortLib/UefiSortLib.inf
> > >        PrintLib|MdePkg/Library/BasePrintLib/BasePrintLib.inf
> > > -      PathLib|ShellPkg/Library/BasePathLib/BasePathLib.inf
> > > +      PathLib|MdeModulePkg/Library/BasePathLib/BasePathLib.inf
> > >  #
> > >
> > MemoryAllocationLib|EmulatorPkg/Library/GuardUefiMemoryAllocationLib/
> > G
> > > MemoryAllocationLib|u
> > > ardUefiMemoryAllocationLib.inf
> > >  #
> > > SafeBlockIoLib|ShellPkg/Library/SafeBlockIoLib/SafeBlockIoLib.inf
> > >  #
> > >
> >
> SafeOpenProtocolLib|ShellPkg/Library/SafeOpenProtocolLib/SafeOpenProto
> > > SafeOpenProtocolLib|c
> > > olLib.inf
> > > diff --git a/MdeModulePkg/Include/Library/PathLib.h
> > > b/MdeModulePkg/Include/Library/PathLib.h
> > > new file mode 100644
> > > index 0000000..ee47352
> > > --- /dev/null
> > > +++ b/MdeModulePkg/Include/Library/PathLib.h
> > > @@ -0,0 +1,56 @@
> > > +/** @file
> > > +  Provides interface to path manipulation functions.
> > > +
> > > +  Copyright (c) 2011, Intel Corporation. All rights reserved.<BR>
> > > + This program and the accompanying materials  are licensed and
> made
> > > + available under the terms and conditions of
> > > the BSD License
> > > +  which accompanies this distribution.  The full text of the
> license
> > > may be found at
> > > +  http://opensource.org/licenses/bsd-license.php.
> > > +
> > > +  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS"
> > > BASIS,
> > > +  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER
> > EXPRESS
> > > + OR
> > > IMPLIED.
> > > +**/
> > > +
> > > +#ifndef _PATH_LIB_
> > > +#define _PATH_LIB_
> > > +
> > > +#include <Base.h>
> > > +#include <Library/BaseMemoryLib.h>
> > > +
> > > +/**
> > > +  Removes the last directory or file entry in a path by changing
> the
> > > last
> > > +  L'\' to a CHAR_NULL.
> > > +
> > > +  @param[in, out] Path    The pointer to the path to modify.
> > > +
> > > +  @retval FALSE     Nothing was found to remove.
> > > +  @retval TRUE      A directory or file was removed.
> > > +**/
> > > +BOOLEAN
> > > +EFIAPI
> > > +PathRemoveLastItem(
> > > +  IN OUT CHAR16 *Path
> > > +  );
> > > +
> > > +/**
> > > +  Function to clean up paths.
> > > +
> > > +  - Single periods in the path are removed.
> > > +  - Double periods in the path are removed along with a single
> parent
> > > directory.
> > > +  - Forward slashes L'/' are converted to backward slashes L'\'.
> > > +
> > > +  This will be done inline and the existing buffer may be larger
> than
> > > required
> > > +  upon completion.
> > > +
> > > +  @param[in] Path       The pointer to the string containing the
> path.
> > > +
> > > +  @retval NULL          An error occured.
> > > +  @return Path in all other instances.
> > > +**/
> > > +CHAR16*
> > > +EFIAPI
> > > +PathCleanUpDirectories(
> > > +  IN CHAR16 *Path
> > > +  );
> > > +
> > > +#endif //_PATH_LIB_
> > > diff --git a/MdeModulePkg/Library/BasePathLib/BasePathLib.c
> > > b/MdeModulePkg/Library/BasePathLib/BasePathLib.c
> > > new file mode 100644
> > > index 0000000..cc46c0f
> > > --- /dev/null
> > > +++ b/MdeModulePkg/Library/BasePathLib/BasePathLib.c
> > > @@ -0,0 +1,123 @@
> > > +/** @file
> > > +  Provides interface to path manipulation functions.
> > > +
> > > +  Copyright (c) 2011 - 2014, Intel Corporation. All rights
> > > reserved.<BR>
> > > +  This program and the accompanying materials  are licensed and
> made
> > > + available under the terms and conditions of
> > > the BSD License
> > > +  which accompanies this distribution.  The full text of the
> license
> > > may be found at
> > > +  http://opensource.org/licenses/bsd-license.php.
> > > +
> > > +  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS"
> > > BASIS,
> > > +  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER
> > EXPRESS
> > > + OR
> > > IMPLIED.
> > > +**/
> > > +
> > > +#include <Base.h>
> > > +#include <Library/BaseMemoryLib.h>
> > > +#include <Library/PathLib.h>
> > > +#include <Library/BaseLib.h>
> > > +#include <Protocol/SimpleTextIn.h>
> > > +
> > > +/**
> > > +  Removes the last directory or file entry in a path by changing
> the
> > > last
> > > +  L'\' to a CHAR_NULL.
> > > +
> > > +  @param[in, out] Path    The pointer to the path to modify.
> > > +
> > > +  @retval FALSE     Nothing was found to remove.
> > > +  @retval TRUE      A directory or file was removed.
> > > +**/
> > > +BOOLEAN
> > > +EFIAPI
> > > +PathRemoveLastItem(
> > > +  IN OUT CHAR16 *Path
> > > +  )
> > > +{
> > > +  CHAR16        *Walker;
> > > +  CHAR16        *LastSlash;
> > > +  //
> > > +  // get directory name from path... ('chop' off extra)
> > > +  //
> > > +  for ( Walker = Path, LastSlash = NULL
> > > +      ; Walker != NULL && *Walker != CHAR_NULL
> > > +      ; Walker++
> > > +     ){
> > > +    if (*Walker == L'\\' && *(Walker + 1) != CHAR_NULL) {
> > > +      LastSlash = Walker+1;
> > > +    }
> > > +  }
> > > +  if (LastSlash != NULL) {
> > > +    *LastSlash = CHAR_NULL;
> > > +    return (TRUE);
> > > +  }
> > > +  return (FALSE);
> > > +}
> > > +
> > > +/**
> > > +  Function to clean up paths.
> > > +
> > > +  - Single periods in the path are removed.
> > > +  - Double periods in the path are removed along with a single
> parent
> > > directory.
> > > +  - Forward slashes L'/' are converted to backward slashes L'\'.
> > > +
> > > +  This will be done inline and the existing buffer may be larger
> than
> > > required
> > > +  upon completion.
> > > +
> > > +  @param[in] Path       The pointer to the string containing the
> path.
> > > +
> > > +  @retval NULL          An error occured.
> > > +  @return Path in all other instances.
> > > +**/
> > > +CHAR16*
> > > +EFIAPI
> > > +PathCleanUpDirectories(
> > > +  IN CHAR16 *Path
> > > +  )
> > > +{
> > > +  CHAR16  *TempString;
> > > +  UINTN   TempSize;
> > > +  if (Path==NULL) {
> > > +    return(NULL);
> > > +  }
> > > +
> > > +  //
> > > +  // Fix up the '/' vs '\'
> > > +  //
> > > +  for (TempString = Path ; TempString != NULL && *TempString !=
> > > CHAR_NULL ; TempString++) {
> > > +    if (*TempString == L'/') {
> > > +      *TempString = L'\\';
> > > +    }
> > > +  }
> > > +
> > > +  //
> > > +  // Fix up the ..
> > > +  //
> > > +  while ((TempString = StrStr(Path, L"\\..\\")) != NULL) {
> > > +    *TempString = CHAR_NULL;
> > > +    TempString  += 4;
> > > +    PathRemoveLastItem(Path);
> > > +    TempSize = StrSize(TempString);
> > > +    CopyMem(Path+StrLen(Path), TempString, TempSize);  }  if
> > > + ((TempString = StrStr(Path, L"\\..")) != NULL && *(TempString +
> > > 3) == CHAR_NULL) {
> > > +    *TempString = CHAR_NULL;
> > > +    PathRemoveLastItem(Path);
> > > +  }
> > > +
> > > +  //
> > > +  // Fix up the .
> > > +  //
> > > +  while ((TempString = StrStr(Path, L"\\.\\")) != NULL) {
> > > +    *TempString = CHAR_NULL;
> > > +    TempString  += 2;
> > > +    TempSize = StrSize(TempString);
> > > +    CopyMem(Path+StrLen(Path), TempString, TempSize);  }  if
> > > + ((TempString = StrStr(Path, L"\\.")) != NULL && *(TempString + 2)
> > > == CHAR_NULL) {
> > > +    *(TempString + 1) = CHAR_NULL;
> > > +  }
> > > +
> > > +
> > > +
> > > +  return (Path);
> > > +}
> > > +
> > > diff --git a/MdeModulePkg/Library/BasePathLib/BasePathLib.inf
> > > b/MdeModulePkg/Library/BasePathLib/BasePathLib.inf
> > > new file mode 100644
> > > index 0000000..7346968
> > > --- /dev/null
> > > +++ b/MdeModulePkg/Library/BasePathLib/BasePathLib.inf
> > > @@ -0,0 +1,38 @@
> > > +##  @file
> > > +#  Provides interface to path manipulation functions.
> > > +#
> > > +#  Copyright (c) 2011, Intel Corporation. All rights reserved.
> <BR> #
> > > +#  This program and the accompanying materials #  are licensed and
> > > +made available under the terms and conditions of
> > > the BSD License
> > > +#  which accompanies this distribution. The full text of the
> license
> > > may be found at
> > > +#  http://opensource.org/licenses/bsd-license.php
> > > +#  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS"
> > > BASIS,
> > > +#  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER
> > EXPRESS
> > > OR IMPLIED.
> > > +#
> > > +#
> > > +##
> > > +
> > > +[Defines]
> > > +  INF_VERSION                    = 0x00010006
> > > +  BASE_NAME                      = BasePathLib
> > > +  FILE_GUID                      = ED244F93-B97A-4a17-83E0-
> > > A03CF2A7F7B4
> > > +  MODULE_TYPE                    = UEFI_DRIVER
> > > +  VERSION_STRING                 = 1.0
> > > +  LIBRARY_CLASS                  = PathLib|UEFI_APPLICATION
> > > UEFI_DRIVER
> > > +
> > > +#
> > > +#  VALID_ARCHITECTURES           = IA32 X64 IPF EBC
> > > +#
> > > +
> > > +[Sources.common]
> > > +  BasePathLib.c
> > > +
> > > +[Packages]
> > > +  MdePkg/MdePkg.dec
> > > +  MdeModulePkg/MdeModulePkg.dec
> > > +
> > > +
> > > +[LibraryClasses]
> > > +  BaseMemoryLib
> > > +  BaseLib
> > > \ No newline at end of file
> > > diff --git a/OvmfPkg/OvmfPkgIa32.dsc b/OvmfPkg/OvmfPkgIa32.dsc
> index
> > > 5adf4c0..9c51c82 100644
> > > --- a/OvmfPkg/OvmfPkgIa32.dsc
> > > +++ b/OvmfPkg/OvmfPkgIa32.dsc
> > > @@ -538,7 +538,7 @@
> > >        ShellLib|ShellPkg/Library/UefiShellLib/UefiShellLib.inf
> > >        SortLib|ShellPkg/Library/UefiSortLib/UefiSortLib.inf
> > >        PrintLib|MdePkg/Library/BasePrintLib/BasePrintLib.inf
> > > -      PathLib|ShellPkg/Library/BasePathLib/BasePathLib.inf
> > > +      PathLib|MdeModulePkg/Library/BasePathLib/BasePathLib.inf
> > >  #
> > > SafeBlockIoLib|ShellPkg/Library/SafeBlockIoLib/SafeBlockIoLib.inf
> > >  #
> > >
> >
> SafeOpenProtocolLib|ShellPkg/Library/SafeOpenProtocolLib/SafeOpenProto
> > > SafeOpenProtocolLib|c
> > > olLib.inf
> > >
> > > diff --git a/OvmfPkg/OvmfPkgIa32X64.dsc
> > b/OvmfPkg/OvmfPkgIa32X64.dsc
> > > index 75ff5f0..7cd2715 100644
> > > --- a/OvmfPkg/OvmfPkgIa32X64.dsc
> > > +++ b/OvmfPkg/OvmfPkgIa32X64.dsc
> > > @@ -545,7 +545,7 @@
> > >        ShellLib|ShellPkg/Library/UefiShellLib/UefiShellLib.inf
> > >        SortLib|ShellPkg/Library/UefiSortLib/UefiSortLib.inf
> > >        PrintLib|MdePkg/Library/BasePrintLib/BasePrintLib.inf
> > > -      PathLib|ShellPkg/Library/BasePathLib/BasePathLib.inf
> > > +      PathLib|MdeModulePkg/Library/BasePathLib/BasePathLib.inf
> > >  #
> > > SafeBlockIoLib|ShellPkg/Library/SafeBlockIoLib/SafeBlockIoLib.inf
> > >  #
> > >
> >
> SafeOpenProtocolLib|ShellPkg/Library/SafeOpenProtocolLib/SafeOpenProto
> > > SafeOpenProtocolLib|c
> > > olLib.inf
> > >
> > > diff --git a/OvmfPkg/OvmfPkgX64.dsc b/OvmfPkg/OvmfPkgX64.dsc index
> > > 7a1e0ee..abf770d 100644
> > > --- a/OvmfPkg/OvmfPkgX64.dsc
> > > +++ b/OvmfPkg/OvmfPkgX64.dsc
> > > @@ -543,7 +543,7 @@
> > >        ShellLib|ShellPkg/Library/UefiShellLib/UefiShellLib.inf
> > >        SortLib|ShellPkg/Library/UefiSortLib/UefiSortLib.inf
> > >        PrintLib|MdePkg/Library/BasePrintLib/BasePrintLib.inf
> > > -      PathLib|ShellPkg/Library/BasePathLib/BasePathLib.inf
> > > +      PathLib|MdeModulePkg/Library/BasePathLib/BasePathLib.inf
> > >  #
> > > SafeBlockIoLib|ShellPkg/Library/SafeBlockIoLib/SafeBlockIoLib.inf
> > >  #
> > >
> >
> SafeOpenProtocolLib|ShellPkg/Library/SafeOpenProtocolLib/SafeOpenProto
> > > SafeOpenProtocolLib|c
> > > olLib.inf
> > >
> > > diff --git a/ShellPkg/Include/Library/PathLib.h
> > > b/ShellPkg/Include/Library/PathLib.h
> > > deleted file mode 100644
> > > index ee47352..0000000
> > > --- a/ShellPkg/Include/Library/PathLib.h
> > > +++ /dev/null
> > > @@ -1,56 +0,0 @@
> > > -/** @file
> > > -  Provides interface to path manipulation functions.
> > > -
> > > -  Copyright (c) 2011, Intel Corporation. All rights reserved.<BR>
> > > -  This program and the accompanying materials
> > > -  are licensed and made available under the terms and conditions
> of
> > > the BSD License
> > > -  which accompanies this distribution.  The full text of the
> license
> > > may be found at
> > > -  http://opensource.org/licenses/bsd-license.php.
> > > -
> > > -  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS"
> > > BASIS,
> > > -  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER
> > EXPRESS
> > > OR IMPLIED.
> > > -**/
> > > -
> > > -#ifndef _PATH_LIB_
> > > -#define _PATH_LIB_
> > > -
> > > -#include <Base.h>
> > > -#include <Library/BaseMemoryLib.h>
> > > -
> > > -/**
> > > -  Removes the last directory or file entry in a path by changing
> the
> > > last
> > > -  L'\' to a CHAR_NULL.
> > > -
> > > -  @param[in, out] Path    The pointer to the path to modify.
> > > -
> > > -  @retval FALSE     Nothing was found to remove.
> > > -  @retval TRUE      A directory or file was removed.
> > > -**/
> > > -BOOLEAN
> > > -EFIAPI
> > > -PathRemoveLastItem(
> > > -  IN OUT CHAR16 *Path
> > > -  );
> > > -
> > > -/**
> > > -  Function to clean up paths.
> > > -
> > > -  - Single periods in the path are removed.
> > > -  - Double periods in the path are removed along with a single
> parent
> > > directory.
> > > -  - Forward slashes L'/' are converted to backward slashes L'\'.
> > > -
> > > -  This will be done inline and the existing buffer may be larger
> than
> > > required
> > > -  upon completion.
> > > -
> > > -  @param[in] Path       The pointer to the string containing the
> path.
> > > -
> > > -  @retval NULL          An error occured.
> > > -  @return Path in all other instances.
> > > -**/
> > > -CHAR16*
> > > -EFIAPI
> > > -PathCleanUpDirectories(
> > > -  IN CHAR16 *Path
> > > -  );
> > > -
> > > -#endif //_PATH_LIB_
> > > diff --git a/ShellPkg/Library/BasePathLib/BasePathLib.c
> > > b/ShellPkg/Library/BasePathLib/BasePathLib.c
> > > deleted file mode 100644
> > > index cc46c0f..0000000
> > > --- a/ShellPkg/Library/BasePathLib/BasePathLib.c
> > > +++ /dev/null
> > > @@ -1,123 +0,0 @@
> > > -/** @file
> > > -  Provides interface to path manipulation functions.
> > > -
> > > -  Copyright (c) 2011 - 2014, Intel Corporation. All rights
> > > reserved.<BR>
> > > -  This program and the accompanying materials
> > > -  are licensed and made available under the terms and conditions
> of
> > > the BSD License
> > > -  which accompanies this distribution.  The full text of the
> license
> > > may be found at
> > > -  http://opensource.org/licenses/bsd-license.php.
> > > -
> > > -  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS"
> > > BASIS,
> > > -  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER
> > EXPRESS
> > > OR IMPLIED.
> > > -**/
> > > -
> > > -#include <Base.h>
> > > -#include <Library/BaseMemoryLib.h>
> > > -#include <Library/PathLib.h>
> > > -#include <Library/BaseLib.h>
> > > -#include <Protocol/SimpleTextIn.h>
> > > -
> > > -/**
> > > -  Removes the last directory or file entry in a path by changing
> the
> > > last
> > > -  L'\' to a CHAR_NULL.
> > > -
> > > -  @param[in, out] Path    The pointer to the path to modify.
> > > -
> > > -  @retval FALSE     Nothing was found to remove.
> > > -  @retval TRUE      A directory or file was removed.
> > > -**/
> > > -BOOLEAN
> > > -EFIAPI
> > > -PathRemoveLastItem(
> > > -  IN OUT CHAR16 *Path
> > > -  )
> > > -{
> > > -  CHAR16        *Walker;
> > > -  CHAR16        *LastSlash;
> > > -  //
> > > -  // get directory name from path... ('chop' off extra)
> > > -  //
> > > -  for ( Walker = Path, LastSlash = NULL
> > > -      ; Walker != NULL && *Walker != CHAR_NULL
> > > -      ; Walker++
> > > -     ){
> > > -    if (*Walker == L'\\' && *(Walker + 1) != CHAR_NULL) {
> > > -      LastSlash = Walker+1;
> > > -    }
> > > -  }
> > > -  if (LastSlash != NULL) {
> > > -    *LastSlash = CHAR_NULL;
> > > -    return (TRUE);
> > > -  }
> > > -  return (FALSE);
> > > -}
> > > -
> > > -/**
> > > -  Function to clean up paths.
> > > -
> > > -  - Single periods in the path are removed.
> > > -  - Double periods in the path are removed along with a single
> parent
> > > directory.
> > > -  - Forward slashes L'/' are converted to backward slashes L'\'.
> > > -
> > > -  This will be done inline and the existing buffer may be larger
> than
> > > required
> > > -  upon completion.
> > > -
> > > -  @param[in] Path       The pointer to the string containing the
> path.
> > > -
> > > -  @retval NULL          An error occured.
> > > -  @return Path in all other instances.
> > > -**/
> > > -CHAR16*
> > > -EFIAPI
> > > -PathCleanUpDirectories(
> > > -  IN CHAR16 *Path
> > > -  )
> > > -{
> > > -  CHAR16  *TempString;
> > > -  UINTN   TempSize;
> > > -  if (Path==NULL) {
> > > -    return(NULL);
> > > -  }
> > > -
> > > -  //
> > > -  // Fix up the '/' vs '\'
> > > -  //
> > > -  for (TempString = Path ; TempString != NULL && *TempString !=
> > > CHAR_NULL ; TempString++) {
> > > -    if (*TempString == L'/') {
> > > -      *TempString = L'\\';
> > > -    }
> > > -  }
> > > -
> > > -  //
> > > -  // Fix up the ..
> > > -  //
> > > -  while ((TempString = StrStr(Path, L"\\..\\")) != NULL) {
> > > -    *TempString = CHAR_NULL;
> > > -    TempString  += 4;
> > > -    PathRemoveLastItem(Path);
> > > -    TempSize = StrSize(TempString);
> > > -    CopyMem(Path+StrLen(Path), TempString, TempSize);
> > > -  }
> > > -  if ((TempString = StrStr(Path, L"\\..")) != NULL && *(TempString
> +
> > > 3) == CHAR_NULL) {
> > > -    *TempString = CHAR_NULL;
> > > -    PathRemoveLastItem(Path);
> > > -  }
> > > -
> > > -  //
> > > -  // Fix up the .
> > > -  //
> > > -  while ((TempString = StrStr(Path, L"\\.\\")) != NULL) {
> > > -    *TempString = CHAR_NULL;
> > > -    TempString  += 2;
> > > -    TempSize = StrSize(TempString);
> > > -    CopyMem(Path+StrLen(Path), TempString, TempSize);
> > > -  }
> > > -  if ((TempString = StrStr(Path, L"\\.")) != NULL && *(TempString
> +
> > > 2) == CHAR_NULL) {
> > > -    *(TempString + 1) = CHAR_NULL;
> > > -  }
> > > -
> > > -
> > > -
> > > -  return (Path);
> > > -}
> > > -
> > > diff --git a/ShellPkg/Library/BasePathLib/BasePathLib.inf
> > > b/ShellPkg/Library/BasePathLib/BasePathLib.inf
> > > deleted file mode 100644
> > > index a9bd6a8..0000000
> > > --- a/ShellPkg/Library/BasePathLib/BasePathLib.inf
> > > +++ /dev/null
> > > @@ -1,38 +0,0 @@
> > > -##  @file
> > > -#  Provides interface to path manipulation functions.
> > > -#
> > > -#  Copyright (c) 2011, Intel Corporation. All rights reserved.
> <BR>
> > > -# -#  This program and the accompanying materials -#  are licensed
> > > and made available under the terms and conditions of the BSD
> License
> > > -#  which accompanies this distribution. The full text of the
> license
> > > may be found at -#  http://opensource.org/licenses/bsd-license.php
> > > -#  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS"
> > > BASIS,
> > > -#  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER
> > EXPRESS
> > > OR IMPLIED.
> > > -#
> > > -#
> > > -##
> > > -
> > > -[Defines]
> > > -  INF_VERSION                    = 0x00010006
> > > -  BASE_NAME                      = BasePathLib
> > > -  FILE_GUID                      = ED244F93-B97A-4a17-83E0-
> > > A03CF2A7F7B4
> > > -  MODULE_TYPE                    = UEFI_DRIVER
> > > -  VERSION_STRING                 = 1.0
> > > -  LIBRARY_CLASS                  = PathLib|UEFI_APPLICATION
> > > UEFI_DRIVER
> > > -
> > > -#
> > > -#  VALID_ARCHITECTURES           = IA32 X64 IPF EBC
> > > -#
> > > -
> > > -[Sources.common]
> > > -  BasePathLib.c
> > > -
> > > -[Packages]
> > > -  MdePkg/MdePkg.dec
> > > -  ShellPkg/ShellPkg.dec
> > > -
> > > -
> > > -[LibraryClasses]
> > > -  BaseMemoryLib
> > > -  BaseLib
> > > \ No newline at end of file
> > > diff --git a/ShellPkg/ShellPkg.dsc b/ShellPkg/ShellPkg.dsc index
> > > 3284c1c..86c5d4d 100644
> > > --- a/ShellPkg/ShellPkg.dsc
> > > +++ b/ShellPkg/ShellPkg.dsc
> > > @@ -48,7 +48,7 @@
> > >
> > >
> HandleParsingLib|ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsi
> > > HandleParsingLib|n
> > > gLib.inf
> > >
> > >
> > >
> > PeCoffGetEntryPointLib|MdePkg/Library/BasePeCoffGetEntryPointLib/Base
> > P
> > > PeCoffGetEntryPointLib|e
> > > CoffGetEntryPointLib.inf
> > > -  PathLib|ShellPkg/Library/BasePathLib/BasePathLib.inf
> > > +  PathLib|MdeModulePkg/Library/BasePathLib/BasePathLib.inf
> > >
> > >  [LibraryClasses.ARM]
> > >    #
> > > diff --git a/StdLib/StdLib.dsc b/StdLib/StdLib.dsc index
> > > b0309e2..e3fe99a 100644
> > > --- a/StdLib/StdLib.dsc
> > > +++ b/StdLib/StdLib.dsc
> > > @@ -82,7 +82,7 @@
> > >    ShellLib|ShellPkg/Library/UefiShellLib/UefiShellLib.inf
> > >
> > >
> FileHandleLib|ShellPkg/Library/UefiFileHandleLib/UefiFileHandleLib.inf
> > >    SortLib|ShellPkg/Library/UefiSortLib/UefiSortLib.inf
> > > -  PathLib|ShellPkg/Library/BasePathLib/BasePathLib.inf
> > > +  PathLib|MdeModulePkg/Library/BasePathLib/BasePathLib.inf
> > >
> > >
> > >
> > ##########################################################
> > ############
> > > #
> > > ############################
> > >  #
> > > diff --git a/StdLib/StdLib.inc b/StdLib/StdLib.inc index
> > > 0c8b04f..64604a3 100644
> > > --- a/StdLib/StdLib.inc
> > > +++ b/StdLib/StdLib.inc
> > > @@ -28,7 +28,7 @@
> > >    ShellLib|ShellPkg/Library/UefiShellLib/UefiShellLib.inf
> > >
> > >
> FileHandleLib|ShellPkg/Library/UefiFileHandleLib/UefiFileHandleLib.inf
> > >    SortLib|ShellPkg/Library/UefiSortLib/UefiSortLib.inf
> > > -  PathLib|ShellPkg/Library/BasePathLib/BasePathLib.inf
> > > +  PathLib|MdeModulePkg/Library/BasePathLib/BasePathLib.inf
> > >
> > >
> ShellCEntryLib|ShellPkg/Library/UefiShellCEntryLib/UefiShellCEntryLib.
> > > ShellCEntryLib|i
> > > nf
> > >
> > >    #
> > > --
> > > 1.8.5
> > >
> > >
> > > -------------------------------------------------------------------
> ---
> > > -
> > > -------
> > > Learn Graph Databases - Download FREE O'Reilly Book "Graph
> Databases"
> > > is the definitive new guide to graph databases and their
> applications.
> > > Written by three acclaimed leaders in the field, this first edition
> is
> > > now available. Download your free book today!
> > > http://p.sf.net/sfu/13534_NeoTech
> > > _______________________________________________
> > > edk2-devel mailing list
> > > edk2-devel@lists.sourceforge.net
> > > https://lists.sourceforge.net/lists/listinfo/edk2-devel
> >
> >
> >
> >
> >
> > ---------------------------------------------------------------------
> ---------
> > _______________________________________________
> > edk2-devel mailing list
> > edk2-devel@lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/edk2-devel
> 
> -----------------------------------------------------------------------
> -------
> _______________________________________________
> edk2-devel mailing list
> edk2-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/edk2-devel





------------------------------------------------------------------------------
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/edk2-devel

Reply via email to