+\r
+ //\r
+ //gShellCurMapping point to node of current file system in the gShellMapList. When reset all mappings,\r
+ //all nodes in the gShellMapList will be free. Then gShellCurMapping will be a dangling pointer, So,\r
+ //after created new mappings, we should reset the gShellCurMapping pointer back to node of current file system.\r
+ //\r
+ if (gShellCurMapping != NULL) {\r
+ gShellCurMapping = NULL;\r
+ CurDir = gEfiShellProtocol->GetEnv(L"cwd");\r
+ if (CurDir != NULL) {\r
+ MapName = AllocateCopyPool (StrSize(CurDir), CurDir);\r
+ if (MapName == NULL) {\r
+ return EFI_OUT_OF_RESOURCES;\r
+ }\r
+ SplitCurDir = StrStr (MapName, L":");\r
+ if (SplitCurDir == NULL) {\r
+ SHELL_FREE_NON_NULL (MapName);\r
+ return EFI_UNSUPPORTED;\r
+ }\r
+ *(SplitCurDir + 1) = CHAR_NULL;\r
+ MapListItem = ShellCommandFindMapItem (MapName);\r
+ if (MapListItem != NULL) {\r
+ gShellCurMapping = MapListItem;\r
+ }\r
+ SHELL_FREE_NON_NULL (MapName);\r
+ }\r
+ }\r