* [PATCH 1/2] ShellPkg-Shell App: Provide fully-qualified path to shell scripts
@ 2018-10-24 16:35 Jim.Dailey
2018-10-24 18:07 ` Carsey, Jaben
2018-10-25 5:47 ` Ni, Ruiyu
0 siblings, 2 replies; 4+ messages in thread
From: Jim.Dailey @ 2018-10-24 16:35 UTC (permalink / raw)
To: edk2-devel; +Cc: ruiyu.ni, jaben.carsey
Add a function to return the fully-qualified version of some path.
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jim Dailey <jim_dailey@dell.com>
---
ShellPkg/Include/Library/ShellLib.h | 40 +++++++++
ShellPkg/Library/UefiShellLib/UefiShellLib.c | 93 +++++++++++++++++++-
2 files changed, 132 insertions(+), 1 deletion(-)
diff --git a/ShellPkg/Include/Library/ShellLib.h b/ShellPkg/Include/Library/ShellLib.h
index 92fddc50f5..cd7e9c47c3 100644
--- a/ShellPkg/Include/Library/ShellLib.h
+++ b/ShellPkg/Include/Library/ShellLib.h
@@ -2,6 +2,7 @@
Provides interface to shell functionality for shell commands and applications.
Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
+ Copyright 2018 Dell Technologies.<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
@@ -35,6 +36,45 @@
extern EFI_SHELL_PARAMETERS_PROTOCOL *gEfiShellParametersProtocol;
extern EFI_SHELL_PROTOCOL *gEfiShellProtocol;
+/**
+ Return the fully-qualified version of a relative path or an absolute path that
+ does not include a file system reference.
+
+ If ASSERTs are disabled, and if the input parameter is NULL or points to NULL,
+ then NULL is returned.
+
+ If the input path contains a ":", this function assumes that it is part of a
+ reference to a file system (e.g. "FS0:"). In such a case, Path is cleaned
+ and returned.
+
+ If there is no working directory or there is not enough memory available to
+ create the fully-qualified path, Path is cleaned and returned.
+
+ Otherwise, the current file system or working directory (as appropriate) is
+ prepended to Path. The input Path is freed and the resulting path is cleaned,
+ assigned to Path, and returned.
+
+ NOTE: If the input path is an empty string, then the current working directory
+ (if it exists) is returned. In other words, an empty input path is treated
+ exactly the same as ".".
+
+ @param[in, out] Path On input, a pointer to some file or directory path. On
+ output, a pointer to the clean and possibly fully-
+ qualified version of the input path. The input pointer
+ may be freed and reassigned on output.
+
+ @retval NULL The input pointer or the path itself was NULL.
+
+ @return A pointer to the clean, fully-qualified version of Path. If memory
+ allocation fails, or if there is no working directory, then a pointer
+ to the clean, but not necessarily fully-qualified version of Path.
+**/
+CHAR16*
+EFIAPI
+FullyQualifyPath(
+ IN OUT CHAR16 **Path
+ );
+
/**
This function will retrieve the information about the file for the handle
specified and store it in allocated pool memory.
diff --git a/ShellPkg/Library/UefiShellLib/UefiShellLib.c b/ShellPkg/Library/UefiShellLib/UefiShellLib.c
index f04adbb63f..52ca3ce1b1 100644
--- a/ShellPkg/Library/UefiShellLib/UefiShellLib.c
+++ b/ShellPkg/Library/UefiShellLib/UefiShellLib.c
@@ -2,7 +2,7 @@
Provides interface to shell functionality for shell commands and applications.
(C) Copyright 2016 Hewlett Packard Enterprise Development LP<BR>
- Copyright 2016 Dell Inc.
+ Copyright 2016-2018 Dell Technologies.<BR>
Copyright (c) 2006 - 2018, 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
@@ -36,6 +36,97 @@ EFI_HANDLE mEfiShellEnvironment2Handle;
FILE_HANDLE_FUNCTION_MAP FileFunctionMap;
EFI_UNICODE_COLLATION_PROTOCOL *mUnicodeCollationProtocol;
+/**
+ Return the fully-qualified version of a relative path or an absolute path that
+ does not include a file system reference.
+
+ If asserts are disabled, and if the input parameter is NULL or points to NULL,
+ then NULL is returned.
+
+ If the input path contains a ":", this function assumes that it is part of a
+ reference to a file system (e.g. "FS0:"). In such a case, Path is cleaned
+ and returned.
+
+ If there is no working directory or there is not enough memory available to
+ create the fully-qualified path, Path is cleaned and returned.
+
+ Otherwise, the current file system or working directory (as appropriate) is
+ prepended to Path. The input Path is freed and the resulting path is cleaned,
+ assigned to Path, and returned.
+
+ NOTE: If the input path is an empty string, then the current working directory
+ (if it exists) is returned. In other words, an empty input path is treated
+ exactly the same as ".".
+
+ @param[in, out] Path On input, a pointer to some file or directory path. On
+ output, a pointer to the clean and possibly fully-
+ qualified version of the input path. The input pointer
+ may be freed and reassigned on output.
+
+ @retval NULL The input pointer or the path itself was NULL.
+
+ @return A pointer to the clean, fully-qualified version of Path. If memory
+ allocation fails, or if there is no working directory, then a pointer
+ to the clean, but not necessarily fully-qualified version of Path.
+**/
+CHAR16*
+EFIAPI
+FullyQualifyPath(
+ IN OUT CHAR16 **Path
+ )
+{
+ CONST CHAR16 *WorkingPath;
+ CHAR16 *FullyQualifiedPath;
+ UINTN Size;
+
+ ASSERT(Path != NULL);
+ ASSERT(*Path != NULL);
+
+ //
+ // Handle erroneous input when asserts are disabled.
+ //
+ if (Path == NULL || *Path == NULL) {
+ return NULL;
+ }
+
+ if (StrStr(*Path, L":") == NULL) {
+ WorkingPath = ShellGetEnvironmentVariable(L"cwd");
+ if (WorkingPath != NULL) {
+ //
+ // Room for both strings plus one more character.
+ //
+ Size = StrSize(WorkingPath) + StrSize(*Path);
+ FullyQualifiedPath = AllocateZeroPool(Size);
+ if (FullyQualifiedPath != NULL) {
+ if (**Path == L'\\' || **Path == L'/') {
+ //
+ // Absolute path: start with the current working directory, then
+ // truncate the new path after the file system part.
+ //
+ StrCpyS(FullyQualifiedPath, Size/sizeof(CHAR16), WorkingPath);
+ *(StrStr(FullyQualifiedPath, L":") + 1) = CHAR_NULL;
+ } else {
+ //
+ // Relative path: start with the working directory and append "\".
+ //
+ StrCpyS(FullyQualifiedPath, Size/sizeof(CHAR16), WorkingPath);
+ StrCatS(FullyQualifiedPath, Size/sizeof(CHAR16), L"\\");
+ }
+ //
+ // Now append the absolute or relative path.
+ //
+ StrCatS(FullyQualifiedPath, Size/sizeof(CHAR16), *Path);
+ FreePool(*Path);
+ *Path = FullyQualifiedPath;
+ }
+ }
+ }
+
+ PathCleanUpDirectories(*Path);
+
+ return *Path;
+}
+
/**
Check if a Unicode character is a hexadecimal character.
--
2.17.0.windows.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 1/2] ShellPkg-Shell App: Provide fully-qualified path to shell scripts
2018-10-24 16:35 [PATCH 1/2] ShellPkg-Shell App: Provide fully-qualified path to shell scripts Jim.Dailey
@ 2018-10-24 18:07 ` Carsey, Jaben
2018-10-25 5:47 ` Ni, Ruiyu
1 sibling, 0 replies; 4+ messages in thread
From: Carsey, Jaben @ 2018-10-24 18:07 UTC (permalink / raw)
To: Jim.Dailey@dell.com, edk2-devel@lists.01.org; +Cc: Ni, Ruiyu
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
Ray?
I can push this one also if you don't see an issue.
> -----Original Message-----
> From: Jim.Dailey@dell.com [mailto:Jim.Dailey@dell.com]
> Sent: Wednesday, October 24, 2018 9:35 AM
> To: edk2-devel@lists.01.org
> Cc: Ni, Ruiyu <ruiyu.ni@intel.com>; Carsey, Jaben <jaben.carsey@intel.com>
> Subject: [edk2][PATCH 1/2] ShellPkg-Shell App: Provide fully-qualified path
> to shell scripts
> Importance: High
>
> Add a function to return the fully-qualified version of some path.
>
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Jim Dailey <jim_dailey@dell.com>
> ---
> ShellPkg/Include/Library/ShellLib.h | 40 +++++++++
> ShellPkg/Library/UefiShellLib/UefiShellLib.c | 93 +++++++++++++++++++-
> 2 files changed, 132 insertions(+), 1 deletion(-)
>
> diff --git a/ShellPkg/Include/Library/ShellLib.h
> b/ShellPkg/Include/Library/ShellLib.h
> index 92fddc50f5..cd7e9c47c3 100644
> --- a/ShellPkg/Include/Library/ShellLib.h
> +++ b/ShellPkg/Include/Library/ShellLib.h
> @@ -2,6 +2,7 @@
> Provides interface to shell functionality for shell commands and
> applications.
>
> Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
> + Copyright 2018 Dell Technologies.<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
> @@ -35,6 +36,45 @@
> extern EFI_SHELL_PARAMETERS_PROTOCOL *gEfiShellParametersProtocol;
> extern EFI_SHELL_PROTOCOL *gEfiShellProtocol;
>
> +/**
> + Return the fully-qualified version of a relative path or an absolute path that
> + does not include a file system reference.
> +
> + If ASSERTs are disabled, and if the input parameter is NULL or points to
> NULL,
> + then NULL is returned.
> +
> + If the input path contains a ":", this function assumes that it is part of a
> + reference to a file system (e.g. "FS0:"). In such a case, Path is cleaned
> + and returned.
> +
> + If there is no working directory or there is not enough memory available to
> + create the fully-qualified path, Path is cleaned and returned.
> +
> + Otherwise, the current file system or working directory (as appropriate) is
> + prepended to Path. The input Path is freed and the resulting path is
> cleaned,
> + assigned to Path, and returned.
> +
> + NOTE: If the input path is an empty string, then the current working
> directory
> + (if it exists) is returned. In other words, an empty input path is treated
> + exactly the same as ".".
> +
> + @param[in, out] Path On input, a pointer to some file or directory path.
> On
> + output, a pointer to the clean and possibly fully-
> + qualified version of the input path. The input pointer
> + may be freed and reassigned on output.
> +
> + @retval NULL The input pointer or the path itself was NULL.
> +
> + @return A pointer to the clean, fully-qualified version of Path. If memory
> + allocation fails, or if there is no working directory, then a pointer
> + to the clean, but not necessarily fully-qualified version of Path.
> +**/
> +CHAR16*
> +EFIAPI
> +FullyQualifyPath(
> + IN OUT CHAR16 **Path
> + );
> +
> /**
> This function will retrieve the information about the file for the handle
> specified and store it in allocated pool memory.
> diff --git a/ShellPkg/Library/UefiShellLib/UefiShellLib.c
> b/ShellPkg/Library/UefiShellLib/UefiShellLib.c
> index f04adbb63f..52ca3ce1b1 100644
> --- a/ShellPkg/Library/UefiShellLib/UefiShellLib.c
> +++ b/ShellPkg/Library/UefiShellLib/UefiShellLib.c
> @@ -2,7 +2,7 @@
> Provides interface to shell functionality for shell commands and
> applications.
>
> (C) Copyright 2016 Hewlett Packard Enterprise Development LP<BR>
> - Copyright 2016 Dell Inc.
> + Copyright 2016-2018 Dell Technologies.<BR>
> Copyright (c) 2006 - 2018, 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
> @@ -36,6 +36,97 @@ EFI_HANDLE mEfiShellEnvironment2Handle;
> FILE_HANDLE_FUNCTION_MAP FileFunctionMap;
> EFI_UNICODE_COLLATION_PROTOCOL *mUnicodeCollationProtocol;
>
> +/**
> + Return the fully-qualified version of a relative path or an absolute path that
> + does not include a file system reference.
> +
> + If asserts are disabled, and if the input parameter is NULL or points to
> NULL,
> + then NULL is returned.
> +
> + If the input path contains a ":", this function assumes that it is part of a
> + reference to a file system (e.g. "FS0:"). In such a case, Path is cleaned
> + and returned.
> +
> + If there is no working directory or there is not enough memory available to
> + create the fully-qualified path, Path is cleaned and returned.
> +
> + Otherwise, the current file system or working directory (as appropriate) is
> + prepended to Path. The input Path is freed and the resulting path is
> cleaned,
> + assigned to Path, and returned.
> +
> + NOTE: If the input path is an empty string, then the current working
> directory
> + (if it exists) is returned. In other words, an empty input path is treated
> + exactly the same as ".".
> +
> + @param[in, out] Path On input, a pointer to some file or directory path.
> On
> + output, a pointer to the clean and possibly fully-
> + qualified version of the input path. The input pointer
> + may be freed and reassigned on output.
> +
> + @retval NULL The input pointer or the path itself was NULL.
> +
> + @return A pointer to the clean, fully-qualified version of Path. If memory
> + allocation fails, or if there is no working directory, then a pointer
> + to the clean, but not necessarily fully-qualified version of Path.
> +**/
> +CHAR16*
> +EFIAPI
> +FullyQualifyPath(
> + IN OUT CHAR16 **Path
> + )
> +{
> + CONST CHAR16 *WorkingPath;
> + CHAR16 *FullyQualifiedPath;
> + UINTN Size;
> +
> + ASSERT(Path != NULL);
> + ASSERT(*Path != NULL);
> +
> + //
> + // Handle erroneous input when asserts are disabled.
> + //
> + if (Path == NULL || *Path == NULL) {
> + return NULL;
> + }
> +
> + if (StrStr(*Path, L":") == NULL) {
> + WorkingPath = ShellGetEnvironmentVariable(L"cwd");
> + if (WorkingPath != NULL) {
> + //
> + // Room for both strings plus one more character.
> + //
> + Size = StrSize(WorkingPath) + StrSize(*Path);
> + FullyQualifiedPath = AllocateZeroPool(Size);
> + if (FullyQualifiedPath != NULL) {
> + if (**Path == L'\\' || **Path == L'/') {
> + //
> + // Absolute path: start with the current working directory, then
> + // truncate the new path after the file system part.
> + //
> + StrCpyS(FullyQualifiedPath, Size/sizeof(CHAR16), WorkingPath);
> + *(StrStr(FullyQualifiedPath, L":") + 1) = CHAR_NULL;
> + } else {
> + //
> + // Relative path: start with the working directory and append "\".
> + //
> + StrCpyS(FullyQualifiedPath, Size/sizeof(CHAR16), WorkingPath);
> + StrCatS(FullyQualifiedPath, Size/sizeof(CHAR16), L"\\");
> + }
> + //
> + // Now append the absolute or relative path.
> + //
> + StrCatS(FullyQualifiedPath, Size/sizeof(CHAR16), *Path);
> + FreePool(*Path);
> + *Path = FullyQualifiedPath;
> + }
> + }
> + }
> +
> + PathCleanUpDirectories(*Path);
> +
> + return *Path;
> +}
> +
> /**
> Check if a Unicode character is a hexadecimal character.
>
> --
> 2.17.0.windows.1
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 1/2] ShellPkg-Shell App: Provide fully-qualified path to shell scripts
2018-10-24 16:35 [PATCH 1/2] ShellPkg-Shell App: Provide fully-qualified path to shell scripts Jim.Dailey
2018-10-24 18:07 ` Carsey, Jaben
@ 2018-10-25 5:47 ` Ni, Ruiyu
2018-10-25 12:55 ` Jim.Dailey
1 sibling, 1 reply; 4+ messages in thread
From: Ni, Ruiyu @ 2018-10-25 5:47 UTC (permalink / raw)
To: Jim.Dailey, edk2-devel; +Cc: jaben.carsey
On 10/25/2018 12:35 AM, Jim.Dailey@dell.com wrote:
> Add a function to return the fully-qualified version of some path.
>
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Jim Dailey <jim_dailey@dell.com>
> ---
> ShellPkg/Include/Library/ShellLib.h | 40 +++++++++
> ShellPkg/Library/UefiShellLib/UefiShellLib.c | 93 +++++++++++++++++++-
> 2 files changed, 132 insertions(+), 1 deletion(-)
>
> diff --git a/ShellPkg/Include/Library/ShellLib.h b/ShellPkg/Include/Library/ShellLib.h
> index 92fddc50f5..cd7e9c47c3 100644
> --- a/ShellPkg/Include/Library/ShellLib.h
> +++ b/ShellPkg/Include/Library/ShellLib.h
> @@ -2,6 +2,7 @@
> Provides interface to shell functionality for shell commands and applications.
>
> Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
> + Copyright 2018 Dell Technologies.<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
> @@ -35,6 +36,45 @@
> extern EFI_SHELL_PARAMETERS_PROTOCOL *gEfiShellParametersProtocol;
> extern EFI_SHELL_PROTOCOL *gEfiShellProtocol;
>
> +/**
> + Return the fully-qualified version of a relative path or an absolute path that
> + does not include a file system reference.
> +
> + If ASSERTs are disabled, and if the input parameter is NULL or points to NULL,
> + then NULL is returned.
> +
> + If the input path contains a ":", this function assumes that it is part of a
> + reference to a file system (e.g. "FS0:"). In such a case, Path is cleaned
> + and returned.
> +
> + If there is no working directory or there is not enough memory available to
> + create the fully-qualified path, Path is cleaned and returned.
> +
> + Otherwise, the current file system or working directory (as appropriate) is
> + prepended to Path. The input Path is freed and the resulting path is cleaned,
> + assigned to Path, and returned.
> +
> + NOTE: If the input path is an empty string, then the current working directory
> + (if it exists) is returned. In other words, an empty input path is treated
> + exactly the same as ".".
> +
> + @param[in, out] Path On input, a pointer to some file or directory path. On
> + output, a pointer to the clean and possibly fully-
> + qualified version of the input path. The input pointer
> + may be freed and reassigned on output.
> +
> + @retval NULL The input pointer or the path itself was NULL.
> +
> + @return A pointer to the clean, fully-qualified version of Path. If memory
> + allocation fails, or if there is no working directory, then a pointer
> + to the clean, but not necessarily fully-qualified version of Path.
> +**/
> +CHAR16*
> +EFIAPI
> +FullyQualifyPath(
> + IN OUT CHAR16 **Path
> + );
> +
> /**
> This function will retrieve the information about the file for the handle
> specified and store it in allocated pool memory.
> diff --git a/ShellPkg/Library/UefiShellLib/UefiShellLib.c b/ShellPkg/Library/UefiShellLib/UefiShellLib.c
> index f04adbb63f..52ca3ce1b1 100644
> --- a/ShellPkg/Library/UefiShellLib/UefiShellLib.c
> +++ b/ShellPkg/Library/UefiShellLib/UefiShellLib.c
> @@ -2,7 +2,7 @@
> Provides interface to shell functionality for shell commands and applications.
>
> (C) Copyright 2016 Hewlett Packard Enterprise Development LP<BR>
> - Copyright 2016 Dell Inc.
> + Copyright 2016-2018 Dell Technologies.<BR>
> Copyright (c) 2006 - 2018, 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
> @@ -36,6 +36,97 @@ EFI_HANDLE mEfiShellEnvironment2Handle;
> FILE_HANDLE_FUNCTION_MAP FileFunctionMap;
> EFI_UNICODE_COLLATION_PROTOCOL *mUnicodeCollationProtocol;
>
> +/**
> + Return the fully-qualified version of a relative path or an absolute path that
> + does not include a file system reference.
> +
> + If asserts are disabled, and if the input parameter is NULL or points to NULL,
> + then NULL is returned.
> +
> + If the input path contains a ":", this function assumes that it is part of a
> + reference to a file system (e.g. "FS0:"). In such a case, Path is cleaned
> + and returned.
> +
> + If there is no working directory or there is not enough memory available to
> + create the fully-qualified path, Path is cleaned and returned.
> +
> + Otherwise, the current file system or working directory (as appropriate) is
> + prepended to Path. The input Path is freed and the resulting path is cleaned,
> + assigned to Path, and returned.
> +
> + NOTE: If the input path is an empty string, then the current working directory
> + (if it exists) is returned. In other words, an empty input path is treated
> + exactly the same as ".".
> +
> + @param[in, out] Path On input, a pointer to some file or directory path. On
> + output, a pointer to the clean and possibly fully-
> + qualified version of the input path. The input pointer
> + may be freed and reassigned on output.
> +
> + @retval NULL The input pointer or the path itself was NULL.
> +
> + @return A pointer to the clean, fully-qualified version of Path. If memory
> + allocation fails, or if there is no working directory, then a pointer
> + to the clean, but not necessarily fully-qualified version of Path.
> +**/
> +CHAR16*
> +EFIAPI
> +FullyQualifyPath(
> + IN OUT CHAR16 **Path
This API assumes *Path is allocated in heap which may bring unnecessary
restriction. How about we accept a CONST CHAR16 * Path, quality and
return a new allocated string?
The parameter can be "IN CONST CHAR16 *Path".
> + )
> +{
> + CONST CHAR16 *WorkingPath;
> + CHAR16 *FullyQualifiedPath;
> + UINTN Size;
> +
> + ASSERT(Path != NULL);
> + ASSERT(*Path != NULL);
> +
> + //
> + // Handle erroneous input when asserts are disabled.
> + //
> + if (Path == NULL || *Path == NULL) {
> + return NULL;
> + }
> +
> + if (StrStr(*Path, L":") == NULL) {
Do we need to handle path like "fs0:a.txt"?
In Windows, it is expanded to <Current Directory of FS0> + a.txt.
> + WorkingPath = ShellGetEnvironmentVariable(L"cwd");
> + if (WorkingPath != NULL) {
> + //
> + // Room for both strings plus one more character.
> + //
> + Size = StrSize(WorkingPath) + StrSize(*Path);
> + FullyQualifiedPath = AllocateZeroPool(Size);
> + if (FullyQualifiedPath != NULL) {
> + if (**Path == L'\\' || **Path == L'/') { > + //
> + // Absolute path: start with the current working directory, then
> + // truncate the new path after the file system part.
> + //
> + StrCpyS(FullyQualifiedPath, Size/sizeof(CHAR16), WorkingPath);
> + *(StrStr(FullyQualifiedPath, L":") + 1) = CHAR_NULL;
> + } else {
> + //
> + // Relative path: start with the working directory and append "\".
> + //
> + StrCpyS(FullyQualifiedPath, Size/sizeof(CHAR16), WorkingPath);
> + StrCatS(FullyQualifiedPath, Size/sizeof(CHAR16), L"\\");
> + }
> + //
> + // Now append the absolute or relative path.
> + //
> + StrCatS(FullyQualifiedPath, Size/sizeof(CHAR16), *Path);
> + FreePool(*Path);
As I mentioned early, we can leave Path as is. Do not assume it's
allocated from heap.
> + *Path = FullyQualifiedPath;
We can just return the FullQualifiedPath without changing Path.
> + }
> + }
> + }
> +
> + PathCleanUpDirectories(*Path);
Agree. It's to remove the potential double slash in "Relative path"
handling and also clean up the original path.
> +
> + return *Path;
> +}
> +
> /**
> Check if a Unicode character is a hexadecimal character.
>
>
--
Thanks,
Ray
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 1/2] ShellPkg-Shell App: Provide fully-qualified path to shell scripts
2018-10-25 5:47 ` Ni, Ruiyu
@ 2018-10-25 12:55 ` Jim.Dailey
0 siblings, 0 replies; 4+ messages in thread
From: Jim.Dailey @ 2018-10-25 12:55 UTC (permalink / raw)
To: ruiyu.ni; +Cc: jaben.carsey, edk2-devel
On Thursday, October 25, 2018 12:48 AM ruiyu.ni@Intel.com wrote:
>On 10/25/2018 12:35 AM, Jim.Dailey@dell.com wrote:
>> Add a function to return the fully-qualified version of some path.
>>
>> ...
>> +CHAR16*
>> +EFIAPI
>> +FullyQualifyPath(
>> + IN OUT CHAR16 **Path
>This API assumes *Path is allocated in heap which may bring unnecessary
>restriction. How about we accept a CONST CHAR16 * Path, quality and
>return a new allocated string?
>The parameter can be "IN CONST CHAR16 *Path".
In the context it is currently used, *Path is allocated in heap. But,
it might be better to handle other types of input too.
>> + if (StrStr(*Path, L":") == NULL) {
>
>Do we need to handle path like "fs0:a.txt"?
>In Windows, it is expanded to <Current Directory of FS0> + a.txt.
Good catch.
>> + *Path = FullyQualifiedPath;
>
>We can just return the FullQualifiedPath without changing Path.
Agreed.
>Thanks,
>Ray
I'll take a cut at version 2 soon.
Regards,
Jim
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2018-10-25 12:55 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-10-24 16:35 [PATCH 1/2] ShellPkg-Shell App: Provide fully-qualified path to shell scripts Jim.Dailey
2018-10-24 18:07 ` Carsey, Jaben
2018-10-25 5:47 ` Ni, Ruiyu
2018-10-25 12:55 ` Jim.Dailey
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox