|
Pharos 0.7.23
Modern Web Framework & Web App Hosting Service.
|
Provides filesystem helpers for directory creation, recursive copy or removal, and file writes. More...
#include "native_fs.h"#include "native_support.h"#include <errno.h>#include <stdio.h>#include <stdlib.h>#include <string.h>#include <dirent.h>#include <sys/stat.h>#include <unistd.h>Go to the source code of this file.
Macros | |
| #define | PHAROS_FS_PATH_SEP '/' |
| #define | pharos_fs_mkdir mkdir |
| #define | pharos_fs_unlink unlink |
Functions | |
| int | ensure_directory (const char *path) |
| Creates a directory path and any missing parent directories. | |
| int | write_text_file (const char *path, const char *content) |
| Writes a text buffer to a file path. | |
| 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. | |
Provides filesystem helpers for directory creation, recursive copy or removal, and file writes.
Definition in file native_fs.c.
| #define pharos_fs_mkdir mkdir |
Definition at line 27 of file native_fs.c.
Referenced by ensure_directory().
| #define PHAROS_FS_PATH_SEP '/' |
Definition at line 26 of file native_fs.c.
Referenced by ensure_directory().
| #define pharos_fs_unlink unlink |
Definition at line 28 of file native_fs.c.
Referenced by remove_directory_recursive().
| 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().
| 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_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().