]> git.proxmox.com Git - mirror_edk2.git/blame - BaseTools/Source/C/Common/OsPath.h
UefiCpuPkg: Move AsmRelocateApLoopStart from Mpfuncs.nasm to AmdSev.nasm
[mirror_edk2.git] / BaseTools / Source / C / Common / OsPath.h
CommitLineData
30fdf114 1/** @file\r
f7496d71 2Header file for helper functions useful to operate file directories by parsing\r
97fa0ee9 3file path.\r
30fdf114 4\r
f7496d71 5Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>\r
2e351cbe 6SPDX-License-Identifier: BSD-2-Clause-Patent\r
30fdf114 7\r
30fdf114
LG
8**/\r
9\r
10#ifndef _EFI_OS_PATH_H\r
11#define _EFI_OS_PATH_H\r
12\r
13#include <Common/UefiBaseTypes.h>\r
14\r
15//\r
16// Functions declarations\r
17//\r
18\r
19CHAR8*\r
20OsPathDirName (\r
21 IN CHAR8 *FilePath\r
22 )\r
23;\r
24/**\r
25\r
26Routine Description:\r
27\r
28 This function returns the directory path which contains the particular path.\r
29 Some examples:\r
30 "a/b/c" -> "a/b"\r
31 "a/b/c/" -> "a/b"\r
32 "a" -> "."\r
33 "." -> ".."\r
34 "/" -> NULL\r
35\r
36 This function does not check for the existence of the file.\r
37\r
38 The caller must free the string returned.\r
39\r
40Arguments:\r
41\r
42 FilePath Path name of file to get the parent directory for.\r
43\r
44Returns:\r
45\r
46 NULL if error\r
47\r
48**/\r
49\r
50\r
51VOID\r
52OsPathNormPathInPlace (\r
53 IN CHAR8 *Path\r
54 )\r
55;\r
56/**\r
57\r
58Routine Description:\r
59\r
60 This function returns the directory path which contains the particular path.\r
61 Some examples:\r
62 "a/b/../c" -> "a/c"\r
63 "a/b//c" -> "a/b/c"\r
64 "a/./b" -> "a/b"\r
65\r
66 This function does not check for the existence of the file.\r
67\r
68Arguments:\r
69\r
70 Path Path name of file to normalize\r
71\r
72Returns:\r
73\r
74 The string is altered in place.\r
75\r
76**/\r
77\r
78\r
79CHAR8*\r
80OsPathPeerFilePath (\r
81 IN CHAR8 *OldPath,\r
82 IN CHAR8 *Peer\r
83 )\r
84;\r
85/**\r
86\r
87Routine Description:\r
88\r
89 This function replaces the final portion of a path with an alternative\r
90 'peer' filename. For example:\r
91 "a/b/../c", "peer" -> "a/b/../peer"\r
92 "a/b/", "peer" -> "a/b/peer"\r
93 "/a", "peer" -> "/peer"\r
94 "a", "peer" -> "peer"\r
95\r
96 This function does not check for the existence of the file.\r
97\r
98Arguments:\r
99\r
100 OldPath Path name of replace the final segment\r
fb0b35e0 101 Peer The new path name to concatenate to become the peer path\r
30fdf114
LG
102\r
103Returns:\r
104\r
105 A CHAR8* string, which must be freed by the caller\r
106\r
107**/\r
108\r
109\r
110BOOLEAN\r
111OsPathExists (\r
112 IN CHAR8 *InputFileName\r
113 )\r
114;\r
115/**\r
116\r
117Routine Description:\r
118\r
119 Checks if a file exists\r
120\r
121Arguments:\r
122\r
123 InputFileName The name of the file to check for existence\r
124\r
125Returns:\r
126\r
127 TRUE The file exists\r
128 FALSE The file does not exist\r
129\r
130**/\r
131\r
132\r
133#endif\r