rcutils  master
C API providing common utilities and data structures.
filesystem.h
Go to the documentation of this file.
1 // Copyright 2017 Open Source Robotics Foundation, Inc.
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 
15 #ifndef RCUTILS__FILESYSTEM_H_
16 #define RCUTILS__FILESYSTEM_H_
17 
18 #ifdef __cplusplus
19 extern "C"
20 {
21 #endif
22 
23 #include <stdbool.h>
24 #include <stddef.h>
25 
26 #include "rcutils/allocator.h"
27 #include "rcutils/macros.h"
29 
31 
40 bool
41 rcutils_get_cwd(char * buffer, size_t max_length);
42 
44 
51 bool
52 rcutils_is_directory(const char * abs_path);
53 
55 
62 bool
63 rcutils_is_file(const char * abs_path);
64 
66 
73 bool
74 rcutils_exists(const char * abs_path);
75 
77 
84 bool
85 rcutils_is_readable(const char * abs_path);
86 
88 
95 bool
96 rcutils_is_writable(const char * abs_path);
97 
99 
106 bool
107 rcutils_is_readable_and_writable(const char * abs_path);
108 
110 
123 char *
125  const char * left_hand_path,
126  const char * right_hand_path,
127  rcutils_allocator_t allocator);
128 
130 
142 char *
144  const char * path,
145  rcutils_allocator_t allocator);
146 
148 
167 bool
168 rcutils_mkdir(const char * abs_path);
169 
170 #ifdef __cplusplus
171 }
172 #endif
173 
174 #endif // RCUTILS__FILESYSTEM_H_
bool rcutils_is_readable(const char *abs_path)
Check if the provided path points to a file/folder readable by current user.
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...
bool rcutils_exists(const char *abs_path)
Check if the provided path points to an existing file/folder.
bool rcutils_is_writable(const char *abs_path)
Check if the provided path points to a file/folder writable by current user.
bool rcutils_mkdir(const char *abs_path)
Create the specified directory.
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...
char * rcutils_to_native_path(const char *path, rcutils_allocator_t allocator)
Return newly allocated string with all argument&#39;s "/" replaced by platform specific separator...
Encapsulation of an allocator.
Definition: allocator.h:45
bool rcutils_is_directory(const char *abs_path)
Check if the provided path points to a directory.
bool rcutils_get_cwd(char *buffer, size_t max_length)
Return current working directory.
#define RCUTILS_WARN_UNUSED
Definition: macros.h:24
#define RCUTILS_PUBLIC
Definition: visibility_control.h:48
bool rcutils_is_file(const char *abs_path)
Check if the provided path points to a file.