Home | History | Annotate | Download | only in Utility

Lines Matching refs:Path

2     Device Abstraction: Path manipulation utilities.

25 /** Identify the type of path pointed to by Path.
28 ^\\ Absolute Path
29 ^\. Relative Path
30 ^[^:\\]: Mapping Path
31 .* Relative Path
34 is the Map Name, pointed to by Path, and the part to the right of the ':' is pointed
37 If Path was not a Mapping Path, then NewPath is set to Path.
39 @param[in] Path Pointer to the path to be classified.
40 @param[out] NewPath Pointer to the path portion of a mapping path.
41 @param[out] Length Length of the Map Name portion of the path.
43 @retval PathAbsolute Path is an absolute path. NewPath points to the first '\'.
44 @retval PathRelative Path is a relative path. NewPath = Path.
45 @retval PathMapping Path is a mapping path. NewPath points to the character following ':'.
46 @retval PathError Path is NULL.
51 IN wchar_t * Path,
58 if(Path == NULL) {
62 *NewPath = Path; // Setup default condition
64 if((*Path == L'\\') || (*Path == L'\0')) {
67 if(*Path == L'.') {
70 /* The easy stuff has been done, now see if this is a mapping path.
71 See if there is a ':' in Path that isn't the first character and is before
74 MapLen = wcscspn(Path, L"\\:");
80 Otherwise, Path[MapLen] == ':' for a mapping path
81 or '\\' for a relative path.
86 if(Path[MapLen] == L':') {
88 *NewPath = &Path[MapLen + 1]; // Point to character after then ':'. Might be '\0'.
95 /* Normalize a narrow-character path and produce a wide-character path
101 @param[in] path A pointer to the narrow-character path to be normalized.
103 @return A pointer to a buffer containing the normalized, wide-character, path.
106 NormalizePath( const char *path)
113 OldPath = AsciiStrToUnicodeStr(path, gMD->UString);
136 /** Process a wide character string representing a Mapping Path and extract the instance number.
139 of the ":" in the Map Name portion of a Mapping Path.
142 Thus Path[Length] must be a ':' and Path[Length - 1] must be a decimal digit.
145 If Path is NULL, an instance value of 0 is returned.
147 @param[in] Path Points to the beginning of a Mapping Path
155 const wchar_t *Path,
162 if((Path != NULL) && (Path[Length] == L':') && (Length > 0)) {
163 for(temp = __UNCONST(&Path[Length - 1]); Length > 0; --Length) {
174 /** Transform a relative path into an absolute path.
176 If Path is NULL, return NULL.
177 Otherwise, pre-pend the CWD to Path then process the resulting path to:
184 Path must be a previously allocated buffer. PathAdjust will
186 and free Path. A pointer to the newly allocated buffer is returned.
188 @param[in] Path A pointer to the path to be transformed. This buffer
191 @return A pointer to a buffer containing the transformed path.
196 wchar_t *Path
203 wmemcpy(NewPath, Path, PATH_MAX);
208 free(Path);
212 /** Replace the leading portion of Path with any aliases.
217 Path must be a previously allocated buffer. PathAlias will
219 then free Path. A pointer to the newly allocated buffer is returned.
221 @param[in] Path A pointer to the original, unaliased, path. This
224 the device abstraction associated with this path.
226 @return A pointer to a buffer containing the aliased path.
231 wchar_t *Path,
239 wmemcpy(NewPath, Path, PATH_MAX);
244 free(Path);
249 /** Parse a path producing the target device, device instance, and file path.
254 @param[in] path
259 to the extracted map name. If the path didn't have a map name,
262 @retval RETURN_SUCCESS The path was parsed successfully.
263 @retval RETURN_NOT_FOUND The path does not map to a valid device.
266 @retval RETURN_INVALID_PARAMETER The path parameter is not valid.
272 IN const char *path,
292 WPath = NormalizePath( path);
320 /* Shift the RHS of the path down to the start of the buffer. */
327 This means that the path looked like "foo:bar:something".
336 /* Transform a relative path into an Absolute path.
344 /* Perform any path aliasing. For example: /dev/foo -> { node.foo, "" }
345 The current volume and directory are updated in the path as needed.
363 /* At this point, WPath is an absolute path,
368 /* This is NOT a mapped path. */
380 /* This is a mapped path. */
398 Parses a normalized wide character path and returns a pointer to the entry
399 following the last \. If a \ is not found in the path the return value will
402 The behavior when passing in a path that has not been normalized is undefined.
404 @param Path - A pointer to a wide character string containing a path to a
413 const wchar_t *Path
418 if (Path == NULL) {
422 Tail = wcsrchr(Path, L'\\');
424 Tail = (wchar_t *) Path;