]> git.proxmox.com Git - mirror_edk2.git/blame - BaseTools/Source/C/Common/OsPath.h
BaseTools: Clean up source files
[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
LG
5Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>\r
6This program and the accompanying materials\r
7are licensed and made available under the terms and conditions of the BSD License\r
8which accompanies this distribution. The full text of the license may be found at\r
9http://opensource.org/licenses/bsd-license.php\r
10\r
11THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
12WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
30fdf114 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
25CHAR8*\r
26OsPathDirName (\r
27 IN CHAR8 *FilePath\r
28 )\r
29;\r
30/**\r
31\r
32Routine 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
46Arguments:\r
47\r
48 FilePath Path name of file to get the parent directory for.\r
49\r
50Returns:\r
51\r
52 NULL if error\r
53\r
54**/\r
55\r
56\r
57VOID\r
58OsPathNormPathInPlace (\r
59 IN CHAR8 *Path\r
60 )\r
61;\r
62/**\r
63\r
64Routine 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
74Arguments:\r
75\r
76 Path Path name of file to normalize\r
77\r
78Returns:\r
79\r
80 The string is altered in place.\r
81\r
82**/\r
83\r
84\r
85CHAR8*\r
86OsPathPeerFilePath (\r
87 IN CHAR8 *OldPath,\r
88 IN CHAR8 *Peer\r
89 )\r
90;\r
91/**\r
92\r
93Routine 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
104Arguments:\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
109Returns:\r
110\r
111 A CHAR8* string, which must be freed by the caller\r
112\r
113**/\r
114\r
115\r
116BOOLEAN\r
117OsPathExists (\r
118 IN CHAR8 *InputFileName\r
119 )\r
120;\r
121/**\r
122\r
123Routine Description:\r
124\r
125 Checks if a file exists\r
126\r
127Arguments:\r
128\r
129 InputFileName The name of the file to check for existence\r
130\r
131Returns:\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