]> git.proxmox.com Git - mirror_edk2.git/blobdiff - ShellPkg/Include/Library/ShellLib.h
ShellPkg-UefiShellLib: Add a function to fully-qualify paths
[mirror_edk2.git] / ShellPkg / Include / Library / ShellLib.h
index 92fddc50f5dd525f07deeb4568d64e8748328825..2ecc5ee0068b9e49f696c95309e4f50fd06b3ada 100644 (file)
@@ -2,6 +2,7 @@
   Provides interface to shell functionality for shell commands and applications.\r
 \r
   Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>\r
+  Copyright 2018 Dell Technologies.<BR>\r
   This program and the accompanying materials\r
   are licensed and made available under the terms and conditions of the BSD License\r
   which accompanies this distribution.  The full text of the license may be found at\r
 extern EFI_SHELL_PARAMETERS_PROTOCOL *gEfiShellParametersProtocol;\r
 extern EFI_SHELL_PROTOCOL            *gEfiShellProtocol;\r
 \r
+/**\r
+  Return a clean, fully-qualified version of an input path.  If the return value\r
+  is non-NULL the caller must free the memory when it is no longer needed.\r
+\r
+  If asserts are disabled, and if the input parameter is NULL, NULL is returned.\r
+\r
+  If there is not enough memory available to create the fully-qualified path or\r
+  a copy of the input path, NULL is returned.\r
+\r
+  If there is no working directory, a clean copy of Path is returned.\r
+\r
+  Otherwise, the current file system or working directory (as appropriate) is\r
+  prepended to Path and the resulting path is cleaned and returned.\r
+\r
+  NOTE: If the input path is an empty string, then the current working directory\r
+  (if it exists) is returned.  In other words, an empty input path is treated\r
+  exactly the same as ".".\r
+\r
+  @param[in] Path  A pointer to some file or directory path.\r
+\r
+  @retval NULL          The input path is NULL or out of memory.\r
+\r
+  @retval non-NULL      A pointer to a clean, fully-qualified version of Path.\r
+                        If there is no working directory, then a pointer to a\r
+                        clean, but not necessarily fully-qualified version of\r
+                        Path.  The caller must free this memory when it is no\r
+                        longer needed.\r
+**/\r
+CHAR16*\r
+EFIAPI\r
+FullyQualifyPath(\r
+  IN     CONST CHAR16     *Path\r
+  );\r
+\r
 /**\r
   This function will retrieve the information about the file for the handle\r
   specified and store it in allocated pool memory.\r