mirror of
				https://github.com/theoludwig/libcproject.git
				synced 2025-05-21 23:21:15 +02:00 
			
		
		
		
	feat: add filesystem_exists
This commit is contained in:
		| @@ -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. | ||||
|  * | ||||
|   | ||||
		Reference in New Issue
	
	Block a user