Files
fx/fx.io/include/fx/io/path.h
T

58 lines
1.6 KiB
C

#ifndef FX_IO_PATH_H_
#define FX_IO_PATH_H_
#include <fx/macros.h>
#include <fx/misc.h>
#include <fx/status.h>
#include <fx/string.h>
#include <stddef.h>
FX_DECLS_BEGIN;
#define FX_TYPE_PATH (fx_path_get_type())
FX_DECLARE_TYPE(fx_path);
FX_TYPE_CLASS_DECLARATION_BEGIN(fx_path)
FX_TYPE_CLASS_DECLARATION_END(fx_path)
#define FX_RV_PATH(cstr) FX_RV(fx_path_create_from_cstr(cstr))
struct fx_file_info;
FX_API fx_type_id fx_path_get_type(void);
FX_TYPE_DEFAULT_CONSTRUCTOR(fx_path, FX_TYPE_PATH);
FX_API fx_path *fx_path_create_root();
FX_API fx_path *fx_path_create_cwd();
FX_API fx_path *fx_path_create_from_cstr(const char *path);
FX_API fx_path *fx_path_duplicate(const fx_path *path);
FX_API fx_path *fx_path_join(const fx_path *paths[], size_t nr_paths);
FX_API fx_path *fx_path_make_absolute(const fx_path *in);
FX_API fx_path *fx_path_make_relative(const fx_path *in);
FX_API fx_path *fx_path_make_canonical(const fx_path *in);
FX_API bool fx_path_is_absolute(const fx_path *path);
FX_API bool fx_path_exists(const fx_path *path);
FX_API bool fx_path_is_file(const fx_path *path);
FX_API bool fx_path_is_directory(const fx_path *path);
FX_API fx_status fx_path_stat(const fx_path *path, struct fx_file_info *out);
FX_API fx_status fx_path_unlink(const fx_path *path);
FX_API enum fx_status fx_path_get_directory(
const fx_path *path,
fx_path **out_dir_path);
FX_API enum fx_status fx_path_get_filename(
const fx_path *path,
fx_string *out_name);
FX_API const char *fx_path_ptr(const fx_path *path);
FX_API size_t fx_path_length(const fx_path *path);
FX_DECLS_END;
#endif