MCPcopy Create free account
hub / github.com/CloverHackyColor/CloverBootloader / PathRemoveLastItem

Function PathRemoveLastItem

MdePkg/Library/BaseLib/FilePaths.c:20–46  ·  view source on GitHub ↗

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. @retval FALSE Nothing was found to remove. @retval TRUE A directory or file was removed. **/

Source from the content-addressed store, hash-verified

18 @retval TRUE A directory or file was removed.
19**/
20BOOLEAN
21EFIAPI
22PathRemoveLastItem(
23 IN OUT CHAR16 *Path
24 )
25{
26 CHAR16 *Walker;
27 CHAR16 *LastSlash;
28 //
29 // get directory name from path... ('chop' off extra)
30 //
31 for ( Walker = Path, LastSlash = NULL
32 ; Walker != NULL && *Walker != CHAR_NULL
33 ; Walker++
34 ){
35 if (*Walker == L'\\' && *(Walker + 1) != CHAR_NULL) {
36 LastSlash = Walker+1;
37 } else if (*Walker == L':' && *(Walker + 1) != L'\\' && *(Walker + 1) != CHAR_NULL) {
38 LastSlash = Walker+1;
39 }
40 }
41 if (LastSlash != NULL) {
42 *LastSlash = CHAR_NULL;
43 return (TRUE);
44 }
45 return (FALSE);
46}
47
48/**
49 Function to clean up paths.

Callers 9

FilePaths.cFile · 0.85
DoStartupScriptFunction · 0.85
ShellProtocol.cFile · 0.85
EfiShellOpenFileListFunction · 0.85
ValidateAndCopyFilesFunction · 0.85
GetDestinationLocationFunction · 0.85
PrintLsOutputFunction · 0.85
ShellCommandRunLsFunction · 0.85
ShellOpenFileByNameFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected