|
Pharos 0.7.23
Modern Web Framework & Web App Hosting Service.
|
Declares native filesystem helper routines. More...
#include <stddef.h>#include <stdlib.h>Go to the source code of this file.
Functions | |
Filesystem helpers | |
| int | ensure_directory (const char *path) |
| Creates a directory path and any missing parent directories. | |
| int | copy_file_binary (const char *source_path, const char *target_path) |
| Copies one file as binary data. | |
| int | copy_directory_recursive (const char *source_dir, const char *target_dir) |
| Recursively copies one directory tree into another location. | |
| int | remove_directory_recursive (const char *target_dir) |
| Recursively removes a directory tree. | |
| int | write_text_file (const char *path, const char *content) |
| Writes a text buffer to a file path. | |
| unsigned char * | read_file_bytes_dup_runtime (const char *path, size_t *out_size) |
| Reads the full content of a binary file into a heap-allocated buffer. | |
| int | write_binary_file_runtime (const char *path, const unsigned char *data, size_t length) |
| Writes a binary byte range to a file, creating parent directories as needed. | |
Declares native filesystem helper routines.
Definition in file native_fs.h.
| int copy_directory_recursive | ( | const char * | source_dir, |
| const char * | target_dir ) |
Recursively copies one directory tree into another location.
| source_dir | Source directory to copy. |
| target_dir | Destination directory to populate. |
Definition at line 132 of file native_fs.c.
References copy_directory_recursive(), copy_file_binary(), ensure_directory(), path_is_directory(), path_join(), and streq().
Referenced by build_app_from_root_native(), build_dev_docs_directory_native(), and copy_directory_recursive().
| int copy_file_binary | ( | const char * | source_path, |
| const char * | target_path ) |
Copies one file as binary data.
| source_path | Path to the source file. |
| target_path | Path to the destination file. |
Definition at line 93 of file native_fs.c.
References ensure_directory(), and path_dirname().
Referenced by build_app_from_root_native(), build_native_backup_report_local_json(), build_native_restore_report_local_json(), copy_directory_recursive(), and native_write_backup_state_snapshot().
| int ensure_directory | ( | const char * | path | ) |
Creates a directory path and any missing parent directories.
| path | Directory path to ensure exists. |
Definition at line 31 of file native_fs.c.
References path_is_directory(), pharos_fs_mkdir, and PHAROS_FS_PATH_SEP.
Referenced by build_app_from_root_native(), build_native_backup_report_local_json(), build_native_restore_report_local_json(), copy_directory_recursive(), copy_file_binary(), ensure_media_subtree(), native_dynamic_relational_prepare_request_state(), native_dynamic_relational_sqlite_runtime_prepare(), native_dynamic_relational_sqlite_runtime_ready(), native_listener_prepare_unix_directory(), native_write_access_log(), native_write_error_log(), store_uploaded_media(), write_binary_file_runtime(), write_error_report_native(), and write_text_file().
| unsigned char * read_file_bytes_dup_runtime | ( | const char * | path, |
| size_t * | out_size ) |
Reads the full content of a binary file into a heap-allocated buffer.
Reads one file into an owned binary buffer and appends a trailing NUL byte for text helpers.
| path | File path to read. |
| out_size | Receives the byte count (may be NULL). |
Reads the full content of a binary file into a heap-allocated buffer.
| path | File path to load. |
| out_size | Receives the byte count excluding the trailing NUL. |
Definition at line 410 of file native_json_runtime_ops.c.
Referenced by handle_dynamic_file_signature_command(), handle_dynamic_multipart_extract_file_command(), handle_dynamic_multipart_extract_text_command(), handle_dynamic_multipart_filename_command(), native_dynamic_relational_file_signature_dup(), request_body_bytes_dup_runtime(), request_form_field_value_dup_runtime(), and store_uploaded_media().
| int remove_directory_recursive | ( | const char * | target_dir | ) |
Recursively removes a directory tree.
| target_dir | Directory tree to remove. |
Definition at line 179 of file native_fs.c.
References path_exists(), path_is_directory(), path_join(), pharos_fs_unlink, remove_directory_recursive(), and streq().
Referenced by build_app_from_root_native(), build_dev_docs_directory_native(), and remove_directory_recursive().
| int write_binary_file_runtime | ( | const char * | path, |
| const unsigned char * | data, | ||
| size_t | length ) |
Writes a binary byte range to a file, creating parent directories as needed.
Writes one binary byte range to a file path, creating parent directories as needed.
| path | Destination file path. |
| data | Bytes to write. |
| length | Number of bytes to write. |
Writes a binary byte range to a file, creating parent directories as needed.
| path | Destination path. |
| data | Bytes to write. |
| length | Number of bytes to write. |
Definition at line 462 of file native_json_runtime_ops.c.
References ensure_directory(), and path_dirname().
Referenced by store_uploaded_media().
| int write_text_file | ( | const char * | path, |
| const char * | content ) |
Writes a text buffer to a file path.
| path | Destination file path. |
| content | Text content to write. |
Definition at line 66 of file native_fs.c.
References ensure_directory(), and path_dirname().
Referenced by build_app_from_root_native(), build_dev_docs_directory_native(), build_native_backup_report_local_json(), emit_website_status_native(), handle_native_runtime_app_command(), handle_native_runtime_command(), native_dynamic_relational_prepare_request_state(), native_write_backup_state_snapshot(), persist_app_state_text_runtime_local(), proof_state_root_load_runtime(), write_mutable_json_doc_runtime(), and write_noindex_markers_recursive_native().