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

55 lines
1.6 KiB
C

#ifndef BLUE_IO_PATH_H_
#define BLUE_IO_PATH_H_
#include <blue/core/macros.h>
#include <blue/core/misc.h>
#include <blue/core/status.h>
#include <blue/ds/string.h>
#include <stddef.h>
B_DECLS_BEGIN;
#define B_TYPE_PATH (b_path_get_type())
B_DECLARE_TYPE(b_path);
B_TYPE_CLASS_DECLARATION_BEGIN(b_path)
B_TYPE_CLASS_DECLARATION_END(b_path)
#define B_RV_PATH(cstr) B_RV(b_path_create_from_cstr(cstr))
struct b_file_info;
BLUE_API b_type b_path_get_type(void);
B_TYPE_DEFAULT_CONSTRUCTOR(b_path, B_TYPE_PATH);
BLUE_API b_path *b_path_create_root();
BLUE_API b_path *b_path_create_cwd();
BLUE_API b_path *b_path_create_from_cstr(const char *path);
BLUE_API b_path *b_path_duplicate(const b_path *path);
BLUE_API b_path *b_path_join(const b_path *paths[], size_t nr_paths);
BLUE_API b_path *b_path_make_absolute(const b_path *in);
BLUE_API b_path *b_path_make_relative(const b_path *in);
BLUE_API b_path *b_path_make_canonical(const b_path *in);
BLUE_API bool b_path_is_absolute(const b_path *path);
BLUE_API bool b_path_exists(const b_path *path);
BLUE_API bool b_path_is_file(const b_path *path);
BLUE_API bool b_path_is_directory(const b_path *path);
BLUE_API b_status b_path_stat(const b_path *path, struct b_file_info *out);
BLUE_API b_status b_path_unlink(const b_path *path);
BLUE_API enum b_status b_path_get_directory(
const b_path *path, b_path **out_dir_path);
BLUE_API enum b_status b_path_get_filename(const b_path *path, b_string *out_name);
BLUE_API const char *b_path_ptr(const b_path *path);
BLUE_API size_t b_path_length(const b_path *path);
B_DECLS_END;
#endif