]>
Commit | Line | Data |
---|---|---|
30fdf114 | 1 | /** @file\r |
97fa0ee9 YL |
2 | Header file for helper functions useful to operate file directories by parsing \r |
3 | file path.\r | |
30fdf114 | 4 | \r |
97fa0ee9 | 5 | Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.<BR>\r |
40d841f6 | 6 | This program and the accompanying materials \r |
30fdf114 LG |
7 | are licensed and made available under the terms and conditions of the BSD License \r |
8 | which accompanies this distribution. The full text of the license may be found at \r | |
9 | http://opensource.org/licenses/bsd-license.php \r | |
10 | \r | |
11 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r | |
12 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r | |
13 | \r | |
30fdf114 LG |
14 | **/\r |
15 | \r | |
16 | #ifndef _EFI_OS_PATH_H\r | |
17 | #define _EFI_OS_PATH_H\r | |
18 | \r | |
19 | #include <Common/UefiBaseTypes.h>\r | |
20 | \r | |
21 | //\r | |
22 | // Functions declarations\r | |
23 | //\r | |
24 | \r | |
25 | CHAR8*\r | |
26 | OsPathDirName (\r | |
27 | IN CHAR8 *FilePath\r | |
28 | )\r | |
29 | ;\r | |
30 | /**\r | |
31 | \r | |
32 | Routine Description:\r | |
33 | \r | |
34 | This function returns the directory path which contains the particular path.\r | |
35 | Some examples:\r | |
36 | "a/b/c" -> "a/b"\r | |
37 | "a/b/c/" -> "a/b"\r | |
38 | "a" -> "."\r | |
39 | "." -> ".."\r | |
40 | "/" -> NULL\r | |
41 | \r | |
42 | This function does not check for the existence of the file.\r | |
43 | \r | |
44 | The caller must free the string returned.\r | |
45 | \r | |
46 | Arguments:\r | |
47 | \r | |
48 | FilePath Path name of file to get the parent directory for.\r | |
49 | \r | |
50 | Returns:\r | |
51 | \r | |
52 | NULL if error\r | |
53 | \r | |
54 | **/\r | |
55 | \r | |
56 | \r | |
57 | VOID\r | |
58 | OsPathNormPathInPlace (\r | |
59 | IN CHAR8 *Path\r | |
60 | )\r | |
61 | ;\r | |
62 | /**\r | |
63 | \r | |
64 | Routine Description:\r | |
65 | \r | |
66 | This function returns the directory path which contains the particular path.\r | |
67 | Some examples:\r | |
68 | "a/b/../c" -> "a/c"\r | |
69 | "a/b//c" -> "a/b/c"\r | |
70 | "a/./b" -> "a/b"\r | |
71 | \r | |
72 | This function does not check for the existence of the file.\r | |
73 | \r | |
74 | Arguments:\r | |
75 | \r | |
76 | Path Path name of file to normalize\r | |
77 | \r | |
78 | Returns:\r | |
79 | \r | |
80 | The string is altered in place.\r | |
81 | \r | |
82 | **/\r | |
83 | \r | |
84 | \r | |
85 | CHAR8*\r | |
86 | OsPathPeerFilePath (\r | |
87 | IN CHAR8 *OldPath,\r | |
88 | IN CHAR8 *Peer\r | |
89 | )\r | |
90 | ;\r | |
91 | /**\r | |
92 | \r | |
93 | Routine Description:\r | |
94 | \r | |
95 | This function replaces the final portion of a path with an alternative\r | |
96 | 'peer' filename. For example:\r | |
97 | "a/b/../c", "peer" -> "a/b/../peer"\r | |
98 | "a/b/", "peer" -> "a/b/peer"\r | |
99 | "/a", "peer" -> "/peer"\r | |
100 | "a", "peer" -> "peer"\r | |
101 | \r | |
102 | This function does not check for the existence of the file.\r | |
103 | \r | |
104 | Arguments:\r | |
105 | \r | |
106 | OldPath Path name of replace the final segment\r | |
107 | Peer The new path name to concatinate to become the peer path\r | |
108 | \r | |
109 | Returns:\r | |
110 | \r | |
111 | A CHAR8* string, which must be freed by the caller\r | |
112 | \r | |
113 | **/\r | |
114 | \r | |
115 | \r | |
116 | BOOLEAN\r | |
117 | OsPathExists (\r | |
118 | IN CHAR8 *InputFileName\r | |
119 | )\r | |
120 | ;\r | |
121 | /**\r | |
122 | \r | |
123 | Routine Description:\r | |
124 | \r | |
125 | Checks if a file exists\r | |
126 | \r | |
127 | Arguments:\r | |
128 | \r | |
129 | InputFileName The name of the file to check for existence\r | |
130 | \r | |
131 | Returns:\r | |
132 | \r | |
133 | TRUE The file exists\r | |
134 | FALSE The file does not exist\r | |
135 | \r | |
136 | **/\r | |
137 | \r | |
138 | \r | |
139 | #endif\r |