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