19 static char *portable_prefix =
NULL;
20 static bool portable_prefix_searched =
false;
23 #ifdef RZ_DEFINE_CONSTRUCTOR_NEEDS_PRAGMA
24 #pragma RZ_DEFINE_CONSTRUCTOR_PRAGMA_ARGS(init_portable_prefix)
26 RZ_DEFINE_CONSTRUCTOR(init_portable_prefix)
27 static void init_portable_prefix(
void) {
31 #ifdef RZ_DEFINE_DESTRUCTOR_NEEDS_PRAGMA
32 #pragma RZ_DEFINE_DESTRUCTOR_PRAGMA_ARGS(fini_portable_prefix)
34 RZ_DEFINE_DESTRUCTOR(fini_portable_prefix)
35 static void fini_portable_prefix(
void) {
37 portable_prefix_searched =
false;
41 static char *set_portable_prefix(
void) {
66 bool in_bindir = bindir_real !=
NULL;
75 bool exe_exists = exe_path_real !=
NULL;
100 free(portable_prefix);
104 portable_prefix = set_portable_prefix();
106 portable_prefix_searched =
true;
124 if (!portable_prefix_searched) {
125 portable_prefix = set_portable_prefix();
126 portable_prefix_searched =
true;
130 if (portable_prefix) {
295 char buf[PATH_MAX] = { 0 };
301 wchar_t buf[MAX_PATH] = { 0 };
303 wchar_t *wpath = rz_utf8_to_utf16(
path);
306 if (
len > 0 &&
len < MAX_PATH - 1) {
307 return rz_utf16_to_utf8_l(
buf,
len);
static static fork const void static count static fd const char const char static newpath const char static path const char path
RZ_API void Ht_() free(HtName_(Ht) *ht)
return strdup("=SP r13\n" "=LR r14\n" "=PC r15\n" "=A0 r0\n" "=A1 r1\n" "=A2 r2\n" "=A3 r3\n" "=ZF zf\n" "=SF nf\n" "=OF vf\n" "=CF cf\n" "=SN or0\n" "gpr lr .32 56 0\n" "gpr pc .32 60 0\n" "gpr cpsr .32 64 0 ____tfiae_________________qvczn\n" "gpr or0 .32 68 0\n" "gpr tf .1 64.5 0 thumb\n" "gpr ef .1 64.9 0 endian\n" "gpr jf .1 64.24 0 java\n" "gpr qf .1 64.27 0 sticky_overflow\n" "gpr vf .1 64.28 0 overflow\n" "gpr cf .1 64.29 0 carry\n" "gpr zf .1 64.30 0 zero\n" "gpr nf .1 64.31 0 negative\n" "gpr itc .4 64.10 0 if_then_count\n" "gpr gef .4 64.16 0 great_or_equal\n" "gpr r0 .32 0 0\n" "gpr r1 .32 4 0\n" "gpr r2 .32 8 0\n" "gpr r3 .32 12 0\n" "gpr r4 .32 16 0\n" "gpr r5 .32 20 0\n" "gpr r6 .32 24 0\n" "gpr r7 .32 28 0\n" "gpr r8 .32 32 0\n" "gpr r9 .32 36 0\n" "gpr r10 .32 40 0\n" "gpr r11 .32 44 0\n" "gpr r12 .32 48 0\n" "gpr r13 .32 52 0\n" "gpr r14 .32 56 0\n" "gpr r15 .32 60 0\n" "gpr r16 .32 64 0\n" "gpr r17 .32 68 0\n")
RZ_API const char * rz_file_basename(const char *path)
RZ_API char * rz_file_tmpdir(void)
RZ_API bool rz_file_is_directory(const char *str)
RZ_API char * rz_file_dirname(const char *path)
RZ_API RZ_OWN char * rz_file_path_join(RZ_NONNULL const char *s1, RZ_NULLABLE const char *s2)
Concatenate two paths to create a new one with s1+s2 with the correct path separator.
#define RZ_STR_ISNOTEMPTY(x)
RZ_API char * rz_str_newf(const char *fmt,...) RZ_PRINTF_CHECK(1
RZ_API char * rz_sys_getenv(const char *key)
Get the value of an environment variable named key or NULL if none exists.
RZ_API int rz_sys_getpid(void)
RZ_API char * rz_sys_pid_to_path(int pid)
#define RZ_FREE_CUSTOM(x, y)
#define RZ_HOME_CONFIGDIR
#define RZ_HOME_CONFIG_RC_DIR
#define RZ_HOME_CONFIG_RC
RZ_API void rz_th_lock_leave(RZ_NONNULL RzThreadLock *thl)
Releases a RzThreadLock structure.
RZ_API void rz_th_lock_free(RZ_NULLABLE RzThreadLock *thl)
Frees a RzThreadLock structure.
RZ_API RZ_OWN RzThreadLock * rz_th_lock_new(bool recursive)
Allocates and initialize a RzThreadLock structure.
RZ_API void rz_th_lock_enter(RZ_NONNULL RzThreadLock *thl)
Acquires a RzThreadLock structure.
RZ_API RZ_OWN char * rz_path_home_config(void)
Return the home directory for config files (e.g. ~/.config/rizin)
RZ_API RZ_OWN char * rz_path_system_rc(void)
Return the system path of the global rizinrc file.
RZ_API RZ_OWN char * rz_path_incdir(void)
Return the directory where include files are placed.
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.
RZ_API RZ_OWN char * rz_path_home_config_rc(void)
Return the path of the rizinrc file in the home config directory.
RZ_API RZ_OWN char * rz_path_home_prefix(RZ_NULLABLE const char *path)
Return path prefixed by the home prefix.
RZ_API RZ_OWN char * rz_path_system(RZ_NULLABLE const char *path)
Return the full system path of the given subpath path.
RZ_API RZ_OWN char * rz_path_home_cache(void)
Return the home directory for cache files (e.g. ~/.cache/rizin)
RZ_API RZ_OWN char * rz_path_home_history(void)
Return the path for the command history file.
RZ_API void rz_path_set_prefix(RZ_NONNULL const char *path)
Return path prefixed by the Rizin install prefix.
RZ_API RZ_OWN char * rz_path_libdir(void)
Return the directory where the Rizin libraries are placed.
RZ_API RZ_OWN char * rz_path_bindir(void)
Return the directory where the Rizin binaries are placed.
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 /....
RZ_API RZ_OWN char * rz_path_prefix(RZ_NULLABLE const char *path)
Return path prefixed by the Rizin install prefix.
RZ_API RZ_OWN char * rz_path_home_config_rcdir(void)
Return the home directory of config rizinrc.d.
RZ_API RZ_OWN char * rz_path_home_rc(void)
Return the path of the rizinrc file in the home directory.
RZ_API RZ_OWN char * rz_path_home(RZ_NULLABLE const char *path)
Return a new path relative to the home directory.