rcutils  master
C API providing common utilities and data structures.
Functions
filesystem.h File Reference
#include <stdbool.h>
#include <stddef.h>
#include "rcutils/macros.h"
#include "rcutils/visibility_control.h"

Go to the source code of this file.

Functions

bool rcutils_get_cwd (char *buffer, size_t max_length)
 Return current working directory. More...
 
bool rcutils_is_directory (const char *abs_path)
 Check if the provided path points to a directory. More...
 
bool rcutils_is_file (const char *abs_path)
 Check if the provided path points to a file. More...
 
bool rcutils_exists (const char *abs_path)
 Check if the provided path points to an existing file/folder. More...
 
bool rcutils_is_readable (const char *abs_path)
 Check if the provided path points to a file/folder readable by current user. More...
 
bool rcutils_is_writable (const char *abs_path)
 Check if the provided path points to a file/folder writable by current user. More...
 
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. More...
 
const char * rcutils_join_path (const char *left_hand_path, const char *right_hand_path)
 Concatenate path adding the right delimiter according to the platform. More...
 

Function Documentation

◆ rcutils_get_cwd()

bool rcutils_get_cwd ( char *  buffer,
size_t  max_length 
)

Return current working directory.

Parameters
[in]bufferAllocated string to store current directory path to
[in]max_lengthmaximum 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_pathAbsolute 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_pathAbsolute 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_pathAbsolute 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_pathAbsolute 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_pathAbsolute 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_pathAbsolute 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()

const char* rcutils_join_path ( const char *  left_hand_path,
const char *  right_hand_path 
)

Concatenate path adding the right delimiter according to the platform.

Parameters
[in]left_hand_path
[in]right_hand_path
Returns
const char * concatenated path on success NULL on invalid arguments NULL on failure