mirror of
https://github.com/theoludwig/libcproject.git
synced 2024-11-08 22:31:31 +01:00
feat: add filesystem_exists
This commit is contained in:
parent
be8a63ca8a
commit
ad0a460923
@ -27,6 +27,10 @@ int filesystem_write(string_t path, byte_t *file_content, off_t file_size) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool filesystem_exists(string_t path) {
|
||||
return access(path, F_OK) == 0;
|
||||
}
|
||||
|
||||
string_t filesystem_get_mimetype(string_t path) {
|
||||
if (string_ends_with(path, ".html")) {
|
||||
return "text/html";
|
||||
|
@ -37,6 +37,16 @@ int filesystem_read(string_t path, byte_t **file_content, off_t *file_size);
|
||||
*/
|
||||
int filesystem_write(string_t path, byte_t *file_content, off_t file_size);
|
||||
|
||||
/**
|
||||
* @brief Check if a path exists.
|
||||
*
|
||||
* @param path
|
||||
* @retval true if the path exists.
|
||||
* @retval false if the path does not exist.
|
||||
* @since v3.1.0
|
||||
*/
|
||||
bool filesystem_exists(string_t path);
|
||||
|
||||
/**
|
||||
* @brief Get the mimetype of a file.
|
||||
*
|
||||
|
Loading…
Reference in New Issue
Block a user