00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016 #ifndef GRU_PATH_H
00017 #define GRU_PATH_H
00018
00019 #include <fcntl.h>
00020 #include <stdbool.h>
00021 #include <string.h>
00022 #if !defined(_WIN32) && !defined(_WIN64)
00023 #include <unistd.h>
00024 #else
00025 #include <direct.h>
00026 #include <io.h>
00027
00028 #define R_OK 4
00029 #define W_OK 2
00030 #define mkdir(x, y) _mkdir(x)
00031 #endif // !defined(_WIN32) && !defined(_WIN64)
00032
00033 #include <sys/stat.h>
00034 #include <sys/types.h>
00035
00036 #include "common/gru_portable.h"
00037 #include "common/gru_status.h"
00038
00039 #ifdef __cplusplus
00040 extern "C" {
00041 #endif
00042
00043 #define APPEND_SIZE_REMAP 64
00044
00045 #ifndef FILE_SEPARATOR
00046 #define FILE_SEPARATOR "/"
00047 #endif
00048
00049 typedef bool (*gru_path_cond_t)(const char *, gru_status_t *status);
00050
00058 gru_export bool gru_path_exists(const char *filename, gru_status_t *status);
00059
00067 gru_export bool gru_path_fexists(int fd, gru_status_t *status);
00068
00076 gru_export bool gru_path_can_read_write(const char *filename, gru_status_t *status);
00077
00086 gru_export bool gru_path_rename_cond(
00087 const char *filename, gru_path_cond_t cond, gru_status_t *status);
00088
00096 gru_export bool gru_path_rename(const char *filename, gru_status_t *status);
00097
00106 gru_export char *gru_path_format(const char *dir, const char *name, gru_status_t *status);
00107
00115 gru_export bool gru_path_mkdir(const char *path, gru_status_t *status);
00116
00124 gru_export bool gru_path_mkdirs(const char *path, gru_status_t *status);
00125
00126 #ifdef __cplusplus
00127 }
00128 #endif
00129
00130 #endif