#include <fcntl.h>
#include <stdbool.h>
#include <string.h>
#include <unistd.h>
#include <sys/stat.h>
#include <sys/types.h>
#include "common/gru_portable.h"
#include "common/gru_status.h"
Go to the source code of this file.
|
gru_export bool | gru_path_exists (const char *filename, gru_status_t *status) |
| Checks whether a given file exists. More...
|
|
gru_export bool | gru_path_fexists (int fd, gru_status_t *status) |
| Checks whether a given file exists based on it's file descriptor. More...
|
|
gru_export bool | gru_path_can_read_write (const char *filename, gru_status_t *status) |
| Checks whether can read/write a given file. More...
|
|
gru_export bool | gru_path_rename_cond (const char *filename, gru_path_cond_t cond, gru_status_t *status) |
| Renames a file based on a condition. More...
|
|
gru_export bool | gru_path_rename (const char *filename, gru_status_t *status) |
| Renames a file. More...
|
|
gru_export char * | gru_path_format (const char *dir, const char *name, gru_status_t *status) |
| Formats a path. More...
|
|
gru_export bool | gru_path_mkdir (const char *path, gru_status_t *status) |
| Create a directory. More...
|
|
gru_export bool | gru_path_mkdirs (const char *path, gru_status_t *status) |
| Given a path, this function will recursively create directories. More...
|
|
#define APPEND_SIZE_REMAP 64 |
#define FILE_SEPARATOR "/" |
typedef bool(* gru_path_cond_t)(const char *, gru_status_t *status) |
Checks whether can read/write a given file.
- Parameters
-
filename | the filename |
status | status structure containing error code/description in case of failure |
- Returns
Checks whether a given file exists.
- Parameters
-
filename | the filename |
status | status structure containing error code/description in case of failure |
- Returns
Checks whether a given file exists based on it's file descriptor.
- Parameters
-
fd | the file descriptor |
status | status structure containing error code/description in case of failure |
- Returns
Formats a path.
- Parameters
-
dir | directory of the file |
name | name of the file |
status | status structure containing error code/description in case of failure |
- Returns
- the formatted path
Create a directory.
- Parameters
-
path | directory path |
status | status structure containing error code/description in case of failure |
- Returns
- true if successful or false otherwise
Given a path, this function will recursively create directories.
- Parameters
-
path | The path |
status | status structure containing error code/description in case of failure |
- Returns
- true if successfully create the directories or false otherwise
Renames a file.
- Parameters
-
filename | the filename |
status | status structure containing error code/description in case of failure |
- Returns
- true if successful or false otherwise
Renames a file based on a condition.
- Parameters
-
filename | the filename |
cond | condition that must be fulfilled for the rename to occur |
status | status structure containing error code/description in case of failure |
- Returns
- true if successful or false otherwise