rtengine/src/runtime/fsutils.h
2024-01-31 22:48:51 +01:00

46 lines
983 B
C

#ifndef RT_FSUITLS_H
#define RT_FSUTILS_H
/* File system utilities */
#include "runtime.h"
#include <stdbool.h>
#ifdef __cplusplus
extern "C" {
#endif
typedef enum {
RT_DIRENT_TYPE_FILE,
RT_DIRENT_TYPE_DIRECTORY,
RT_DIRENT_TYPE_SYMLINK,
} rt_dirent_type;
typedef struct {
char name[260];
rt_dirent_type type;
bool is_last;
} rt_dirent;
typedef struct rt_scandir_handle_s rt_scandir_handle;
RT_DLLEXPORT rt_scandir_handle *rtScanDirectory(const char *path);
RT_DLLEXPORT rt_dirent rtNextDirectoryEntry(rt_scandir_handle *dir);
RT_DLLEXPORT void rtCloseDirectory(rt_scandir_handle *dir);
RT_DLLEXPORT bool rtCreateDirectory(const char *path);
RT_DLLEXPORT size_t rtGetFileSize(const char *path);
RT_DLLEXPORT uint64_t rtGetFileModificationTimestamp(const char *path);
/* Does not really fit here, but it is mostly useful for comparison with file timestamps. */
RT_DLLEXPORT uint64_t rtGetCurrentTimestamp(void);
#ifdef __cplusplus
}
#endif
#endif