61 lines
1.2 KiB
C
61 lines
1.2 KiB
C
|
|
#ifndef CGE_FS_H
|
||
|
|
#define CGE_FS_H
|
||
|
|
|
||
|
|
#ifdef __cplusplus
|
||
|
|
extern "C" {
|
||
|
|
#endif
|
||
|
|
|
||
|
|
#include <stdint.h>
|
||
|
|
|
||
|
|
typedef struct CgeFsDir CgeFsDir;
|
||
|
|
|
||
|
|
#if defined(_WIN32) || defined(_WIN64)
|
||
|
|
#define CGE_FS_NAME_MAX 512
|
||
|
|
#elif defined(__NetBSD__)
|
||
|
|
#define CGE_FS_NAME_MAX 512
|
||
|
|
#else
|
||
|
|
#define CGE_FS_NAME_MAX 256
|
||
|
|
#endif
|
||
|
|
|
||
|
|
enum CgeFsCode {
|
||
|
|
CGE_FS_EOK,
|
||
|
|
CGE_FS_EUNKNOWN,
|
||
|
|
CGE_FS_EEOF,
|
||
|
|
CGE_FS_ENOENT,
|
||
|
|
CGE_FS_EEXIST,
|
||
|
|
CGE_FS_EACCES,
|
||
|
|
CGE_FS_ENOTDIR,
|
||
|
|
CGE_FS_EMFILE,
|
||
|
|
CGE_FS_ENAMETOOLONG,
|
||
|
|
CGE_FS_EIO,
|
||
|
|
};
|
||
|
|
|
||
|
|
enum CgeFsType {
|
||
|
|
CGE_FS_FILE,
|
||
|
|
CGE_FS_DIR,
|
||
|
|
};
|
||
|
|
|
||
|
|
typedef struct CgeFsInfo {
|
||
|
|
char name[CGE_FS_NAME_MAX];
|
||
|
|
int type;
|
||
|
|
uint64_t size;
|
||
|
|
uint64_t mtime;
|
||
|
|
} CgeFsInfo;
|
||
|
|
|
||
|
|
CgeFsDir *CgeFsOpen(const char *path, int *result);
|
||
|
|
int CgeFsNext(CgeFsDir *d, CgeFsInfo *info, int *result);
|
||
|
|
void CgeFsClose(CgeFsDir *d);
|
||
|
|
|
||
|
|
int CgeFsStat(const char *path, CgeFsInfo *info, int *result);
|
||
|
|
int CgeFsCreateDir(const char *path, int *result);
|
||
|
|
int CgeFsRemoveDir(const char *path, int *result);
|
||
|
|
int CgeFsDelete(const char *path, int *result);
|
||
|
|
int CgeFsRename(const char *from, const char *to, int *result);
|
||
|
|
int CgeFsCopy(const char *from, const char *to, int *result);
|
||
|
|
|
||
|
|
#ifdef __cplusplus
|
||
|
|
}
|
||
|
|
#endif
|
||
|
|
|
||
|
|
#endif /* CGE_FS_H */
|