Go to the source code of this file.
Functions | |
le_result_t | le_path_GetDir (const char *pathPtr, const char *separatorPtr, char *dirPtr, size_t dirBuffSize) |
char * | le_path_GetBasenamePtr (const char *pathPtr, const char *separatorPtr) |
le_result_t | le_path_Concat (const char *separatorPtr, char *pathPtr, size_t pathSize,...) |
bool | le_path_IsSubpath (const char *path1Ptr, const char *path2Ptr, const char *separatorPtr) |
bool | le_path_IsEquivalent (const char *path1Ptr, const char *path2Ptr, const char *separatorPtr) |
Legato Path API include file.
Copyright (C) Sierra Wireless Inc. Use of this work is subject to license. license.
le_result_t le_path_Concat | ( | const char * | separatorPtr, |
char * | pathPtr, | ||
size_t | pathSize, | ||
... | |||
) |
Concatenates multiple path segments together.
Concatenates the path in the pathPtr buffer with all path segments and stores the result in the pathPtr. Ensures that where path segments are joined there is only one separator between them. Duplicate trailing separators in the resultant path are also dropped.
If there is not enough space in pathPtr for all segments, as many characters from the segments that will fit in the buffer will be copied and LE_OVERFLOW will be returned. Partial UTF-8 characters and partial separators will never be copied.
[in] | separatorPtr | Separator string. |
[in,out] | pathPtr | Buffer containing the first segment and where the resultant path will be stored. |
[in] | pathSize | Buffer size. |
char* le_path_GetBasenamePtr | ( | const char * | pathPtr, |
const char * | separatorPtr | ||
) |
Gets a pointer to the basename (the last node in the path). This function gets the basename by returning a pointer to the character following the last separator.
[in] | pathPtr | Path string. |
[in] | separatorPtr | Separator string. |
le_result_t le_path_GetDir | ( | const char * | pathPtr, |
const char * | separatorPtr, | ||
char * | dirPtr, | ||
size_t | dirBuffSize | ||
) |
Gets the directory, which is the entire path up to and including the last separator.
[in] | pathPtr | Path string. |
[in] | separatorPtr | Separator string. |
[out] | dirPtr | Buffer to store the directory string. |
[in] | dirBuffSize | Size of the directory buffer in bytes. |
bool le_path_IsEquivalent | ( | const char * | path1Ptr, |
const char * | path2Ptr, | ||
const char * | separatorPtr | ||
) |
Checks if path1 and path2 are equivalent, ignoring trailing separators. For example, all the following paths are equivalent.
/a/b/c /a/b/c/ /a/b/c///
[in] | path1Ptr | Path 1 string. |
[in] | path2Ptr | Path 2 string. |
[in] | separatorPtr | Separator string. |
bool le_path_IsSubpath | ( | const char * | path1Ptr, |
const char * | path2Ptr, | ||
const char * | separatorPtr | ||
) |
Checks if path2 is a subpath of path1. That is path2 has the same starting nodes as path2. For example, path2 is a subpath of path1 if:
path1 = /a/b/c path2 = /a/b/c/d/e
[in] | path1Ptr | Path 1 string. |
[in] | path2Ptr | Path 2 string. |
[in] | separatorPtr | Separator string. |