00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
#ifndef __FILE_H
00018
#define __FILE_H
00019
00020
00021
00031
00032
00033
#if HAVE_LIMITS_H
00034
# include <limits.h>
00035
#endif
00036
00037
#if HAVE_LINUX_LIMITS_H
00038
# include <linux/limits.h>
00039
#endif
00040
00041
#ifndef PATH_MAX
00042
# define PATH_MAX 4096
00043
#endif
00044
00045
00046
00047
#if defined (HAVE_DIRENT_H)
00048
# include <dirent.h>
00049
#elif defined (WIN32)
00050
00051
00052
#include <io.h>
00053
#include <stddef.h>
00054
00055
struct dirent
00056 {
00057
char *d_name;
00058 };
00059
00060
typedef struct _dir
00061 {
00062
long findfirst_handle;
00063
struct _finddata_t *finddata;
00064
struct dirent *direntry;
00065
struct dirent *firstentry;
00066 } DIR;
00067
00068
#endif
00069
00070
00071
00072 EXTERN_C_BEGIN
00073
00074
00075
00084 LIBGIFT_EXPORT
00085 BOOL file_exists (
const char *file);
00086
00091 LIBGIFT_EXPORT
00092 BOOL file_direxists (
const char *path);
00093
00100 LIBGIFT_EXPORT
00101 BOOL file_stat (
const char *file,
struct stat *stbuf);
00102
00106 LIBGIFT_EXPORT
00107
char *file_dirname (
const char *file);
00108
00112 LIBGIFT_EXPORT
00113
char *file_basename (
const char *file);
00114
00121 LIBGIFT_EXPORT
00122
char *file_secure_path (
const char *path);
00123
00152 LIBGIFT_EXPORT
00153
char *file_read_line (FILE *f,
char **outbuf);
00154
00155
00156
00162 LIBGIFT_EXPORT
00163
char *file_expand_path (
const char *path);
00164
00173 LIBGIFT_EXPORT
00174 BOOL file_create_path (
const char *path,
int mode);
00175
00182 LIBGIFT_EXPORT
00183 BOOL file_mkdir (
const char *path,
int mode);
00184
00185
00186
00190 LIBGIFT_EXPORT
00191 FILE *file_temp (
char **out,
char *module);
00192
00193
00194
00200 LIBGIFT_EXPORT
00201 BOOL file_rmdir (
const char *path);
00202
00216 LIBGIFT_EXPORT
00217 BOOL file_cp (
const char *src,
const char *dst);
00218
00231 LIBGIFT_EXPORT
00232 BOOL file_mv (
const char *src,
const char *dst);
00233
00247 LIBGIFT_EXPORT
00248 BOOL file_slurp (
const char *path,
char **data,
unsigned long *len);
00249
00260 LIBGIFT_EXPORT
00261 BOOL file_dump (
const char *path,
const char *data,
unsigned long len);
00262
00263
00264
00268 LIBGIFT_EXPORT
00269 FILE *file_open (
const char *path,
const char *mode);
00270
00274 LIBGIFT_EXPORT
00275
int file_close (FILE *f);
00276
00281 #define FILE_CLOSE(fhandle) \
00282
do { \
00283
file_close (*(fhandle)); \
00284
*(fhandle) = NULL; \
00285
} while (0)
00286
00290 LIBGIFT_EXPORT
00291
int file_unlink (
const char *path);
00292
00293
00294
00298 LIBGIFT_EXPORT
00299 DIR *file_opendir (
const char *dir);
00300
00304 LIBGIFT_EXPORT
00305
struct dirent *file_readdir (DIR *dh);
00306
00310 LIBGIFT_EXPORT
00311
int file_closedir (DIR *dh);
00312
00313
00314
00323 LIBGIFT_EXPORT
00324
char *file_host_path (
const char *gift_path);
00325
00334 LIBGIFT_EXPORT
00335
char *file_unix_path (
const char *host_path);
00336
00337
00338
00339 EXTERN_C_END
00340
00341
00342
00343
#endif