33#ifndef _SIR_FILESYSTEM_H_INCLUDED
34# define _SIR_FILESYSTEM_H_INCLUDED
36# include "sir/platform.h"
38# if defined(__cplusplus)
44# define SIR_PATH_BUFFER_GROW_BY 32
48# define SIR_STAT_NONEXISTENT ((off_t)0xffffff02)
53 SIR_PATH_REL_TO_CWD = 0x0001,
54 SIR_PATH_REL_TO_APP = 0x0002
57bool _sir_pathgetstat(
const char* restrict path,
struct stat* restrict st, sir_rel_to rel_to);
58bool _sir_pathexists(
const char* restrict path,
bool* restrict exists, sir_rel_to rel_to);
59bool _sir_openfile(FILE* restrict* restrict f,
const char* restrict path,
60 const char* restrict mode, sir_rel_to rel_to);
62char* _sir_getcwd(
void);
64char* _sir_getappfilename(
void);
65char* _sir_getappbasename(
void);
66char* _sir_getappdir(
void);
68char* _sir_getbasename(
char* restrict path);
69char* _sir_getdirname(
char* restrict path);
71bool _sir_ispathrelative(
const char* restrict path,
bool* restrict relative);
72bool _sir_getrelbasepath(
const char* restrict path,
bool* restrict relative,
73 const char* restrict* restrict base_path, sir_rel_to rel_to);
75bool _sir_deletefile(
const char* restrict path);
81ssize_t _sir_readlink(
const char* restrict path,
char* restrict buf,
size_t bufsize)
83 return readlink(path, buf, bufsize);
88int _sir_aixself(
char* buffer,
size_t* size);
91# if defined(__OpenBSD__)
92int _sir_openbsdself(
char* buffer,
int size);
95# if defined(__OpenBSD__) || (defined(_AIX) && defined(__PASE__))
96int _sir_resolvepath(
const char* restrict path,
char* restrict buffer,
size_t size);
99# if defined(__cplusplus)