2023-07-16 12:21:52 +02:00
|
|
|
/**
|
|
|
|
* @file path.h
|
|
|
|
* @brief Menu Path
|
|
|
|
* @ingroup menu
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef PATH_H__
|
2023-07-02 21:52:58 +02:00
|
|
|
#define PATH_H__
|
|
|
|
|
|
|
|
|
2023-07-09 00:01:41 +02:00
|
|
|
#include <stdbool.h>
|
2023-08-17 22:26:18 +02:00
|
|
|
#include <stdlib.h>
|
2023-07-09 00:01:41 +02:00
|
|
|
|
|
|
|
|
2023-07-16 12:21:52 +02:00
|
|
|
/** @brief Path Structure */
|
2023-07-02 21:52:58 +02:00
|
|
|
typedef struct {
|
|
|
|
char *buffer;
|
2023-08-09 20:41:54 +02:00
|
|
|
char *root;
|
2023-07-02 21:52:58 +02:00
|
|
|
size_t capacity;
|
|
|
|
} path_t;
|
|
|
|
|
|
|
|
|
2023-08-09 20:41:54 +02:00
|
|
|
path_t *path_init (char *prefix, char *string);
|
2023-07-02 21:52:58 +02:00
|
|
|
void path_free (path_t *path);
|
|
|
|
path_t *path_clone (path_t *string);
|
2023-08-09 20:41:54 +02:00
|
|
|
path_t *path_clone_push (path_t *path, char *string);
|
2023-07-02 21:52:58 +02:00
|
|
|
char *path_get (path_t *path);
|
|
|
|
char *path_last_get (path_t *path);
|
2023-07-09 00:01:41 +02:00
|
|
|
bool path_is_root (path_t *path);
|
2023-07-02 21:52:58 +02:00
|
|
|
void path_pop (path_t *path);
|
2023-08-17 22:26:18 +02:00
|
|
|
void path_push (path_t *path, char *string);
|
|
|
|
void path_push_subdir (path_t *path, char *string);
|
2023-07-02 21:52:58 +02:00
|
|
|
char *path_ext_get (path_t *path);
|
|
|
|
void path_ext_remove (path_t *path);
|
|
|
|
void path_ext_replace (path_t *path, char *ext);
|
|
|
|
|
|
|
|
|
|
|
|
#endif
|