/builddir/build/BUILD/gru-0.1.0/src/io/gru_path.h File Reference
#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.
Defines |
#define | APPEND_SIZE_REMAP 64 |
#define | FILE_SEPARATOR "/" |
Typedefs |
typedef bool(* | gru_path_cond_t )(const char *, gru_status_t *status) |
Functions |
gru_export bool | gru_path_exists (const char *filename, gru_status_t *status) |
| Checks whether a given file exists.
|
gru_export bool | gru_path_fexists (int fd, gru_status_t *status) |
| Checks whether a given file exists based on it's file descriptor.
|
gru_export bool | gru_path_can_read_write (const char *filename, gru_status_t *status) |
| Checks whether can read/write a given file.
|
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.
|
gru_export bool | gru_path_rename (const char *filename, gru_status_t *status) |
| Renames a file.
|
gru_export char * | gru_path_format (const char *dir, const char *name, gru_status_t *status) |
| Formats a path.
|
gru_export bool | gru_path_mkdir (const char *path, gru_status_t *status) |
| Create a directory.
|
gru_export bool | gru_path_mkdirs (const char *path, gru_status_t *status) |
| Given a path, this function will recursively create directories.
|
Define Documentation
#define APPEND_SIZE_REMAP 64 |
#define FILE_SEPARATOR "/" |
Typedef Documentation
Function Documentation
gru_export bool gru_path_can_read_write |
( |
const char * |
filename, |
|
|
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:
gru_export bool gru_path_exists |
( |
const char * |
filename, |
|
|
gru_status_t * |
status | |
|
) |
| | |
Checks whether a given file exists.
- Parameters:
-
| filename | the filename |
| status | status structure containing error code/description in case of failure |
- Returns:
gru_export bool gru_path_fexists |
( |
int |
fd, |
|
|
gru_status_t * |
status | |
|
) |
| | |
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:
gru_export char* gru_path_format |
( |
const char * |
dir, |
|
|
const char * |
name, |
|
|
gru_status_t * |
status | |
|
) |
| | |
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
gru_export bool gru_path_mkdir |
( |
const char * |
path, |
|
|
gru_status_t * |
status | |
|
) |
| | |
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
gru_export bool gru_path_mkdirs |
( |
const char * |
path, |
|
|
gru_status_t * |
status | |
|
) |
| | |
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
gru_export bool gru_path_rename |
( |
const char * |
filename, |
|
|
gru_status_t * |
status | |
|
) |
| | |
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