#include <stdbool.h>
#include <stddef.h>
#include "rcutils/allocator.h"
#include "rcutils/macros.h"
#include "rcutils/visibility_control.h"
Go to the source code of this file.
◆ rcutils_get_cwd()
bool rcutils_get_cwd |
( |
char * |
buffer, |
|
|
size_t |
max_length |
|
) |
| |
Return current working directory.
- Parameters
-
[in] | buffer | Allocated string to store current directory path to |
[in] | max_length | maximum length to be stored in buffer |
- Returns
- bool True if success False if buffer is NULL False on failure
◆ rcutils_is_directory()
bool rcutils_is_directory |
( |
const char * |
abs_path | ) |
|
Check if the provided path points to a directory.
- Parameters
-
[in] | abs_path | Absolute path to check. |
- Returns
- bool True if directory False if abs_path is NULL False on failure
◆ rcutils_is_file()
bool rcutils_is_file |
( |
const char * |
abs_path | ) |
|
Check if the provided path points to a file.
- Parameters
-
[in] | abs_path | Absolute path to check. |
- Returns
- bool True if file False if abs_path is NULL False on failure
◆ rcutils_exists()
bool rcutils_exists |
( |
const char * |
abs_path | ) |
|
Check if the provided path points to an existing file/folder.
- Parameters
-
[in] | abs_path | Absolute path to check. |
- Returns
- bool True if the path exists False if abs_path is NULL False on failure
◆ rcutils_is_readable()
bool rcutils_is_readable |
( |
const char * |
abs_path | ) |
|
Check if the provided path points to a file/folder readable by current user.
- Parameters
-
[in] | abs_path | Absolute path to check. |
- Returns
- bool True if the file is readable False if abs_path is NULL False on failure
◆ rcutils_is_writable()
bool rcutils_is_writable |
( |
const char * |
abs_path | ) |
|
Check if the provided path points to a file/folder writable by current user.
- Parameters
-
[in] | abs_path | Absolute path to check. |
- Returns
- bool True if the file is writable False if abs_path is NULL False on failure
◆ rcutils_is_readable_and_writable()
bool rcutils_is_readable_and_writable |
( |
const char * |
abs_path | ) |
|
Check if the provided path points to a file/folder both readable and writable by current user.
- Parameters
-
[in] | abs_path | Absolute path to check. |
- Returns
- bool True if the file is redable and writable False otherwise False if abs_path is NULL False on failure
◆ rcutils_join_path()
char* rcutils_join_path |
( |
const char * |
left_hand_path, |
|
|
const char * |
right_hand_path, |
|
|
rcutils_allocator_t |
allocator |
|
) |
| |
Return newly allocated string with arguments separated by correct delimiter for the platform.
This function allocates memory and returns it to the caller. It is up to the caller to release the memory once it is done with it by calling deallocate
on the same allocator passed here.
- Parameters
-
[in] | left_hand_path | |
[in] | right_hand_path | |
[in] | allocator | |
- Returns
- char * concatenated path on success NULL on invalid arguments NULL on failure
◆ rcutils_to_native_path()
Return newly allocated string with all argument's "/" replaced by platform specific separator.
This function allocates memory and returns it to the caller. It is up to the caller to release the memory once it is done with it by calling deallocate
on the same allocator passed here.
- Parameters
-
- Returns
- char * path using platform specific delimiters on success NULL on invalid arguments NULL on failure
◆ rcutils_mkdir()
bool rcutils_mkdir |
( |
const char * |
abs_path | ) |
|
Create the specified directory.
This function creates an absolutely-specified directory. If any of the intermediate directories do not exist, this function will return False. If the abs_path already exists, and is a directory, this function will return True.
This function is not thread-safe due to mkdir races as described in the openat(2) documentation.
- Parameters
-
[in] | abs_path | |
[in] | allocator | |
- Returns
- bool True if making the directory was successful, False otherwise False if path is NULL False if path is empty False if path is not absolute False if any intermediate directories don't exist