Skip to content

Commit

Permalink
feat: add filesystem_remove
Browse files Browse the repository at this point in the history
  • Loading branch information
theoludwig committed Aug 6, 2023
1 parent ad0a460 commit dff2836
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/filesystem.c
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down
11 changes: 11 additions & 0 deletions lib/filesystem.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*
Expand Down

0 comments on commit dff2836

Please sign in to comment.