#ifndef SENTRY_PATH_H_INCLUDED
#define SENTRY_PATH_H_INCLUDED
#include "sentry_boot.h"
#include <stdio.h>
#ifdef SENTRY_PLATFORM_WINDOWS
typedef wchar_t sentry_pathchar_t;
# define SENTRY_PATH_PRI "S"
#else
typedef char sentry_pathchar_t;
# define SENTRY_PATH_PRI "s"
#endif
struct sentry_path_s {
sentry_pathchar_t *path;
};
struct sentry_filelock_s {
struct sentry_path_s *path;
int fd;
bool is_locked;
};
typedef struct sentry_path_s sentry_path_t;
typedef struct sentry_pathiter_s sentry_pathiter_t;
typedef struct sentry_filelock_s sentry_filelock_t;
sentry_path_t *sentry__path_absolute(const sentry_path_t *path);
sentry_path_t *sentry__path_current_exe(void);
sentry_path_t *sentry__path_dir(const sentry_path_t *path);
sentry_path_t *sentry__path_from_str(const char *s);
sentry_path_t *sentry__path_from_str_owned(char *s);
sentry_path_t *sentry__path_join_str(
const sentry_path_t *base, const char *other);
sentry_path_t *sentry__path_append_str(
const sentry_path_t *base, const char *suffix);
sentry_path_t *sentry__path_clone(const sentry_path_t *path);
void sentry__path_free(sentry_path_t *path);
const sentry_pathchar_t *sentry__path_filename(const sentry_path_t *path);
bool sentry__path_filename_matches(
const sentry_path_t *path, const char *filename);
bool sentry__path_ends_with(const sentry_path_t *path, const char *suffix);
bool sentry__path_is_dir(const sentry_path_t *path);
bool sentry__path_is_file(const sentry_path_t *path);
int sentry__path_remove(const sentry_path_t *path);
int sentry__path_remove_all(const sentry_path_t *path);
int sentry__path_create_dir_all(const sentry_path_t *path);
int sentry__path_touch(const sentry_path_t *path);
size_t sentry__path_get_size(const sentry_path_t *path);
char *sentry__path_read_to_buffer(const sentry_path_t *path, size_t *size_out);
int sentry__path_write_buffer(
const sentry_path_t *path, const char *buf, size_t buf_len);
int sentry__path_append_buffer(
const sentry_path_t *path, const char *buf, size_t buf_len);
sentry_pathiter_t *sentry__path_iter_directory(const sentry_path_t *path);
const sentry_path_t *sentry__pathiter_next(sentry_pathiter_t *piter);
void sentry__pathiter_free(sentry_pathiter_t *piter);
sentry_filelock_t *sentry__filelock_new(sentry_path_t *path);
bool sentry__filelock_try_lock(sentry_filelock_t *lock);
void sentry__filelock_unlock(sentry_filelock_t *lock);
void sentry__filelock_free(sentry_filelock_t *lock);
#ifdef SENTRY_PLATFORM_WINDOWS
sentry_path_t *sentry__path_from_wstr(const wchar_t *s);
sentry_path_t *sentry__path_join_wstr(
const sentry_path_t *base, const wchar_t *other);
#endif
static inline sentry_path_t *
sentry__path_new(const sentry_pathchar_t *s)
{
#ifdef SENTRY_PLATFORM_WINDOWS
return sentry__path_from_wstr(s);
#else
return sentry__path_from_str(s);
#endif
}
#endif