diff --git a/lib/filesystem.c b/lib/filesystem.c index c714b10..3b4a79d 100644 --- a/lib/filesystem.c +++ b/lib/filesystem.c @@ -31,6 +31,10 @@ bool filesystem_exists(string_t path) { return access(path, F_OK) == 0; } +int filesystem_remove(string_t path) { + return remove(path); +} + string_t filesystem_get_mimetype(string_t path) { if (string_ends_with(path, ".html")) { return "text/html"; diff --git a/lib/filesystem.h b/lib/filesystem.h index 94df9ab..8339571 100644 --- a/lib/filesystem.h +++ b/lib/filesystem.h @@ -47,6 +47,17 @@ int filesystem_write(string_t path, byte_t *file_content, off_t file_size); */ bool filesystem_exists(string_t path); +/** + * @brief Removes a path. + * + * @param path + * @return int + * @retval -1 if there is an error. + * @retval 0 for success. + * @since v3.1.0 + */ +int filesystem_remove(string_t path); + /** * @brief Get the mimetype of a file. *