Paths are text strings that contain nodes separated by character separators. Paths are used in many common applications like file system addressing, URLs, etc. so being able to parse them is quite important.
The Path API is intended for general purpose use and supports UTF-8 null-terminated strings and multi-character separators.
The function le_path_GetDir()
is a convenient way to get the path's directory without having to create an iterator. The directory is the portion of the path up to and including the last separator. le_path_GetDir() does not modify the path in anyway (i.e., consecutive paths are left as is), except to drop the node after the last separator.
The function le_path_GetBasenamePtr() is an efficient and convenient function for accessing the last node in the path without having to create an iterator. The returned pointer points to the character following the last separator in the path. Because the basename is actually a portion of the path string, not a copy, any changes to the returned basename will also affect the original path string.
All the functions in this API are thread safe and reentrant unless of course the path iterators or the buffers passed into the functions are shared between threads. If the path iterators or buffers are shared by multiple threads then some other mechanism must be used to ensure these functions are thread safe.
Copyright (C) Sierra Wireless Inc. Use of this work is subject to license. license.