NetSurf
|
Default operations table for files. More...
#include <stdarg.h>
Go to the source code of this file.
Data Structures | |
struct | gui_file_table |
/brief function table for file and filename operations. More... | |
Functions | |
nserror | netsurf_mkpath (char **str, size_t *size, size_t nelm,...) |
Generate a path from one or more component elemnts. More... | |
nserror | netsurf_nsurl_to_path (struct nsurl *url, char **path_out) |
Create a path from a nsurl. More... | |
nserror | netsurf_path_to_nsurl (const char *path, struct nsurl **url) |
Create a nsurl from a path. More... | |
nserror | netsurf_mkdir_all (const char *fname) |
Ensure that all directory elements needed to store a filename exist. More... | |
nserror | netsurf_recursive_rm (const char *path) |
Recursively remove a directory. More... | |
Variables | |
struct gui_file_table * | default_file_table |
Default (posix) file operation table. More... | |
Default operations table for files.
These are file operations that depend upon the filesystem the browser is operating on. These allow the core browser functionality to be filesystem agnostic.
The provided defaults operate on POSIX path names with / as a directory separator in a single hieracy from a root directory.
Other path conventions require the default operations to be overridden. For example windows frontend runs on a filesystem with drive letter and a \ as a separator.
Definition in file file.h.
nserror netsurf_mkdir_all | ( | const char * | fname | ) |
Ensure that all directory elements needed to store a filename exist.
fname | The filename to ensure the path to exists. |
Definition at line 313 of file file.c.
References netsurf_table::file, guit, and gui_file_table::mkdir_all.
Referenced by create_cache_home(), create_config_home(), ro_gui_create_dirs(), store_open(), and write_control().
nserror netsurf_mkpath | ( | char ** | str, |
size_t * | size, | ||
size_t | nelm, | ||
... | |||
) |
Generate a path from one or more component elemnts.
If a string is allocated it must be freed by the caller.
[in,out] | str | pointer to string pointer if this is NULL enough storage will be allocated for the complete path. |
[in,out] | size | The size of the space available if str not NULL on input and if not NULL set to the total output length on output. |
[in] | nelm | The number of elements. |
[in] | ... | The elements of the path as string pointers. |
Definition at line 288 of file file.c.
References netsurf_table::file, guit, and gui_file_table::mkpath.
Referenced by ami_gui_check_resource(), ami_gui_map_filename(), ami_locate_resource(), check_dirname(), create_cache_home(), create_config_home(), get_cachepath(), netsurf_recursive_rm(), nsgtk_option_init(), nsgtk_preferences_dialogPreferences_deleteevent(), nsgtk_preferences_dialogPreferences_destroy(), nsgtk_preferences_dialogPreferences_response(), nsgtk_toolbar_customisation_save(), nsw32_option_init(), nsws_prefs_save(), print_button_clicked_cb(), process_dir_ent(), read_blocks(), read_control(), read_entries(), save_complete_inventory(), save_complete_save_buffer(), save_complete_save_html_document(), savewindowsize_button_clicked_cb(), set_defaults(), store_fname(), unlink_entries(), write_blocks(), write_cache_tag(), write_control(), and write_entries().
Create a path from a nsurl.
[in] | url | The url to encode. |
[out] | path_out | A string containing the result path which must be freed by the caller. |
Definition at line 301 of file file.c.
References netsurf_table::file, guit, and gui_file_table::nsurl_to_path.
Referenced by ro_gui_view_source(), and ro_gui_window_close().
Create a nsurl from a path.
Perform the necessary operations on a path to generate a nsurl.
[in] | path | The path to convert. |
[out] | url | pointer to recive the nsurl, The returned url should be unreferenced by the caller. |
Definition at line 307 of file file.c.
References netsurf_table::file, guit, path(), and gui_file_table::path_to_nsurl.
Referenced by ami_file_open(), ami_handle_applib(), ami_handle_appmsg(), get_resource_url(), gui_get_resource_url(), gui_init(), gui_init2(), nsgtk_get_resource_url(), nsw32_get_resource_url(), ro_msg_dataload(), ro_msg_dataopen(), and tab_init_fname().
nserror netsurf_recursive_rm | ( | const char * | path | ) |
Recursively remove a directory.
If this returns a failure code, there's an unpredictable amount left unremoved.
path | The path to recursively remove |
Definition at line 320 of file file.c.
References netsurf_mkpath(), netsurf_recursive_rm(), NSERROR_NOT_FOUND, NSERROR_OK, NSERROR_UNKNOWN, parent, and path().
Referenced by filename_flush_directory(), initialise(), and netsurf_recursive_rm().
|
extern |
Default (posix) file operation table.
Definition at line 285 of file file.c.
Referenced by netsurf_register().