Rizin
unix-like reverse engineering framework and cli tools
|
#include <rz_util/rz_path.h>
#include <rz_util/rz_file.h>
#include <rz_util/rz_sys.h>
#include <rz_util/rz_str.h>
#include <rz_util/rz_utf8.h>
#include <rz_windows.h>
Go to the source code of this file.
Functions | |
RZ_API void | rz_path_set_prefix (RZ_NONNULL const char *path) |
Return path prefixed by the Rizin install prefix. More... | |
RZ_API RZ_OWN char * | rz_path_prefix (RZ_NULLABLE const char *path) |
Return path prefixed by the Rizin install prefix. More... | |
RZ_API RZ_OWN char * | rz_path_incdir (void) |
Return the directory where include files are placed. More... | |
RZ_API RZ_OWN char * | rz_path_bindir (void) |
Return the directory where the Rizin binaries are placed. More... | |
RZ_API RZ_OWN char * | rz_path_libdir (void) |
Return the directory where the Rizin libraries are placed. More... | |
RZ_API RZ_OWN char * | rz_path_system (RZ_NULLABLE const char *path) |
Return the full system path of the given subpath path . More... | |
RZ_API RZ_OWN char * | rz_path_system_rc (void) |
Return the system path of the global rizinrc file. More... | |
RZ_API RZ_OWN char * | rz_path_home_prefix (RZ_NULLABLE const char *path) |
Return path prefixed by the home prefix. More... | |
RZ_API RZ_OWN char * | rz_path_home_config (void) |
Return the home directory for config files (e.g. ~/.config/rizin) More... | |
RZ_API RZ_OWN char * | rz_path_home_cache (void) |
Return the home directory for cache files (e.g. ~/.cache/rizin) More... | |
RZ_API RZ_OWN char * | rz_path_home_history (void) |
Return the path for the command history file. More... | |
RZ_API RZ_OWN char * | rz_path_home_rc (void) |
Return the path of the rizinrc file in the home directory. More... | |
RZ_API RZ_OWN char * | rz_path_home_config_rc (void) |
Return the path of the rizinrc file in the home config directory. More... | |
RZ_API RZ_OWN char * | rz_path_home_config_rcdir (void) |
Return the home directory of config rizinrc.d. More... | |
RZ_API RZ_OWN char * | rz_path_home (RZ_NULLABLE const char *path) |
Return a new path relative to the home directory. More... | |
RZ_API RZ_OWN char * | rz_path_home_expand (RZ_NULLABLE const char *path) |
Return a new path with the ~ char expanded to the home directory. More... | |
RZ_API RZ_OWN char * | rz_path_realpath (RZ_NULLABLE const char *path) |
Return a canonicalized absolute path. Expands all symbolic links and resolves references to /./, /../ and extra '/' characters. More... | |
Return the directory where the Rizin binaries are placed.
Definition at line 148 of file path.c.
References RZ_BINDIR, and rz_path_prefix().
Referenced by rz_str_version().
RZ_API RZ_OWN char* rz_path_home | ( | RZ_NULLABLE const char * | path | ) |
Return a new path relative to the home directory.
path | Sub-path relative to the home directory |
Definition at line 243 of file path.c.
References free(), NULL, path, rz_file_path_join(), rz_file_tmpdir(), rz_sys_getenv(), and RZ_SYS_HOME.
Referenced by rz_path_home_cache(), rz_path_home_config(), rz_path_home_config_rc(), rz_path_home_config_rcdir(), rz_path_home_expand(), rz_path_home_history(), and rz_path_home_rc().
Return the home directory for cache files (e.g. ~/.cache/rizin)
Definition at line 205 of file path.c.
References RZ_HOME_CACHEDIR, and rz_path_home().
Referenced by main_print_var().
Return the home directory for config files (e.g. ~/.config/rizin)
Definition at line 198 of file path.c.
References RZ_HOME_CONFIGDIR, and rz_path_home().
Referenced by main_print_var().
Return the path of the rizinrc file in the home config directory.
Definition at line 226 of file path.c.
References RZ_HOME_CONFIG_RC, and rz_path_home().
Referenced by main_help(), and rz_core_parse_rizinrc().
Return the home directory of config rizinrc.d.
Definition at line 233 of file path.c.
References RZ_HOME_CONFIG_RC_DIR, and rz_path_home().
Referenced by main_help(), and rz_core_parse_rizinrc().
RZ_API RZ_OWN char* rz_path_home_expand | ( | RZ_NULLABLE const char * | path | ) |
Return a new path with the ~
char expanded to the home directory.
path | Original path that may or may not contain the ~ prefix to refer to the home directory |
~
character replaced with the full path of the home directory Definition at line 268 of file path.c.
References path, rz_path_home(), and strdup().
Referenced by autocmplt_cmd_arg_file(), rz_file_abspath_rel(), rz_sys_chdir(), rz_sys_fopen(), rz_sys_open(), and rz_syscmd_ls().
Return the path for the command history file.
Definition at line 212 of file path.c.
References RZ_HOME_HISTORY, and rz_path_home().
Referenced by rz_core_init(), rz_history_save_handler(), and rz_main_rizin().
RZ_API RZ_OWN char* rz_path_home_prefix | ( | RZ_NULLABLE const char * | path | ) |
Return path
prefixed by the home prefix.
Return path
prefixed by the home prefix. Please note that this is not the home directory, but it is usually something like ~/.local
.
path | Path to put in the home prefix context or NULL to just get the home prefix |
path
prefixed by the home prefix or just the home prefix Definition at line 182 of file path.c.
References free(), NULL, path, rz_file_tmpdir(), RZ_HOME_PREFIX, rz_str_newf(), RZ_SYS_DIR, rz_sys_getenv(), and RZ_SYS_HOME.
Referenced by __get_panels_config_dir_path(), __load_plugins(), cmd_print_format(), hash_load_plugins(), load_scripts_for(), loadSystemPlugins(), main_help(), main_print_var(), rz_core_analysis_cc_init(), rz_core_analysis_sigdb_list(), rz_core_config_init(), rz_core_loadlibs(), rz_core_theme_list(), rz_core_theme_load(), rz_core_visual_hud(), rz_lib_open(), and rz_main_rz_bin().
Return the path of the rizinrc file in the home directory.
Definition at line 219 of file path.c.
References RZ_HOME_RC, and rz_path_home().
Referenced by main_help(), and rz_core_parse_rizinrc().
Return the directory where include files are placed.
Definition at line 141 of file path.c.
References RZ_INCDIR, and rz_path_prefix().
Referenced by main_help(), and main_print_var().
Return the directory where the Rizin libraries are placed.
Definition at line 155 of file path.c.
References RZ_LIBDIR, and rz_path_prefix().
Referenced by main_help(), main_print_var(), rz_core_file_loadlib(), and rz_run_config_env().
RZ_API RZ_OWN char* rz_path_prefix | ( | RZ_NULLABLE const char * | path | ) |
Return path
prefixed by the Rizin install prefix.
The install prefix is taken from the build-time configuration RZ_PREFIX, unless Rizin was not compiled as "portable". In such a case the prefix is discovered from the path of the executable calling this function.
path | Path to put in the install prefix context or NULL to just get the install prefix |
path
prefixed by the Rizin install prefix or just the install prefix Definition at line 121 of file path.c.
References path, rz_file_path_join(), RZ_PREFIX, rz_th_lock_enter(), and rz_th_lock_leave().
Referenced by cmd_print_format(), main_help(), main_print_var(), rz_core_config_init(), rz_egg_lang_include_init(), rz_path_bindir(), rz_path_incdir(), rz_path_libdir(), rz_path_system(), and rz_path_system_rc().
RZ_API RZ_OWN char* rz_path_realpath | ( | RZ_NULLABLE const char * | path | ) |
Return a canonicalized absolute path. Expands all symbolic links and resolves references to /./, /../ and extra '/' characters.
path | Original file path. |
Definition at line 290 of file path.c.
References DWORD, free(), len, NULL, path, rp, and strdup().
RZ_API void rz_path_set_prefix | ( | RZ_NONNULL const char * | path | ) |
Return path
prefixed by the Rizin install prefix.
The install prefix is taken from the build-time configuration RZ_PREFIX, unless Rizin was not compiled as "portable". In such a case the prefix is either discovered from the path of the executable calling this function or stored via the path variable
path | Path to use when to prefix or NULL to use the binary location |
Definition at line 97 of file path.c.
References free(), path, RZ_STR_ISNOTEMPTY, rz_th_lock_enter(), rz_th_lock_leave(), and strdup().
RZ_API RZ_OWN char* rz_path_system | ( | RZ_NULLABLE const char * | path | ) |
Return the full system path of the given subpath path
.
Definition at line 162 of file path.c.
References path, and rz_path_prefix().
Referenced by __func_name_from_ord(), __load_plugins(), analysis_set_os(), bin_pe_parse_imports(), cb_asmarch(), cb_asmcpu(), cb_asmplatform(), cmd_print_format(), get_filetype(), hash_load_plugins(), load_sdb(), loadSystemPlugins(), main_help(), main_print_var(), rizin_fortune_file(), rz_analysis_set_bits(), rz_analysis_set_cpu(), rz_asm_use(), rz_core_analysis_cc_init(), rz_core_analysis_sigdb_list(), rz_core_analysis_type_init(), rz_core_bin_apply_config(), rz_core_config_init(), rz_core_init(), rz_core_theme_list(), rz_core_theme_load(), rz_core_visual_hud(), rz_main_rz_bin(), rz_syscall_setup(), and set_bin_relocs().
Return the system path of the global rizinrc file.
Definition at line 169 of file path.c.
References RZ_GLOBAL_RC, and rz_path_prefix().
Referenced by main_help(), and rz_main_rizin().