6#ifndef PHAROS_NATIVE_SUPPORT_H
7#define PHAROS_NATIVE_SUPPORT_H
66int starts_with(
const char *value,
const char *prefix);
73int streq(
const char *a,
const char *b);
80char *
path_join(
const char *left,
const char *right);
void buffer_init(Buffer *buffer)
Initializes a growable buffer to an empty state.
char * path_join(const char *left, const char *right)
Joins two path segments using the native path separator.
void trim_in_place(char *text)
Trims leading and trailing ASCII whitespace from a string in place.
char * dup_range(const char *start, size_t len)
Duplicates a byte range into a newly allocated NUL-terminated string.
char * path_canonicalize(const char *path)
Normalizes a path by collapsing redundant separators and dot segments.
void buffer_free(Buffer *buffer)
Releases memory owned by a growable buffer.
char * current_working_directory(void)
Returns the current working directory.
int streq(const char *a, const char *b)
Tests whether two strings are exactly equal.
int path_is_directory(const char *path)
Tests whether a filesystem path refers to a directory.
char * path_dirname(const char *path)
Returns the parent directory component of a path.
char * resolve_relative_to(const char *base_dir, const char *value)
Resolves a path value relative to a base directory when needed.
int buffer_append(Buffer *buffer, const void *data, size_t len)
Appends bytes to a growable buffer and maintains a trailing NUL byte.
int buffer_reserve(Buffer *buffer, size_t needed)
Ensures a buffer can hold at least a requested number of bytes.
int path_is_writable(const char *path)
Tests whether a filesystem path is writable by the current process.
char * read_file_text(const char *path)
Reads an entire file into a newly allocated text buffer.
int starts_with(const char *value, const char *prefix)
Tests whether one string starts with another string.
int path_exists(const char *path)
Tests whether a filesystem path currently exists.
Growable byte buffer used by parsing and string assembly helpers.