]>
Commit | Line | Data |
---|---|---|
30fdf114 | 1 | /** @file\r |
f7496d71 | 2 | Header file for helper functions useful to operate file directories by parsing\r |
97fa0ee9 | 3 | file path.\r |
30fdf114 | 4 | \r |
f7496d71 | 5 | Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>\r |
2e351cbe | 6 | SPDX-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 | |
19 | CHAR8*\r | |
20 | OsPathDirName (\r | |
21 | IN CHAR8 *FilePath\r | |
22 | )\r | |
23 | ;\r | |
24 | /**\r | |
25 | \r | |
26 | Routine 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 | |
40 | Arguments:\r | |
41 | \r | |
42 | FilePath Path name of file to get the parent directory for.\r | |
43 | \r | |
44 | Returns:\r | |
45 | \r | |
46 | NULL if error\r | |
47 | \r | |
48 | **/\r | |
49 | \r | |
50 | \r | |
51 | VOID\r | |
52 | OsPathNormPathInPlace (\r | |
53 | IN CHAR8 *Path\r | |
54 | )\r | |
55 | ;\r | |
56 | /**\r | |
57 | \r | |
58 | Routine 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 | |
68 | Arguments:\r | |
69 | \r | |
70 | Path Path name of file to normalize\r | |
71 | \r | |
72 | Returns:\r | |
73 | \r | |
74 | The string is altered in place.\r | |
75 | \r | |
76 | **/\r | |
77 | \r | |
78 | \r | |
79 | CHAR8*\r | |
80 | OsPathPeerFilePath (\r | |
81 | IN CHAR8 *OldPath,\r | |
82 | IN CHAR8 *Peer\r | |
83 | )\r | |
84 | ;\r | |
85 | /**\r | |
86 | \r | |
87 | Routine 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 | |
98 | Arguments:\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 |
103 | Returns:\r | |
104 | \r | |
105 | A CHAR8* string, which must be freed by the caller\r | |
106 | \r | |
107 | **/\r | |
108 | \r | |
109 | \r | |
110 | BOOLEAN\r | |
111 | OsPathExists (\r | |
112 | IN CHAR8 *InputFileName\r | |
113 | )\r | |
114 | ;\r | |
115 | /**\r | |
116 | \r | |
117 | Routine Description:\r | |
118 | \r | |
119 | Checks if a file exists\r | |
120 | \r | |
121 | Arguments:\r | |
122 | \r | |
123 | InputFileName The name of the file to check for existence\r | |
124 | \r | |
125 | Returns:\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 |