diff --git a/binr/radare2/radare2.c b/binr/radare2/radare2.c index 8d9f8187db..df039614b8 100644 --- a/binr/radare2/radare2.c +++ b/binr/radare2/radare2.c @@ -1286,10 +1286,11 @@ int main(int argc, char **argv, char **envp) { } } { - const char *global_rc = R2_PREFIX"/share/radare2/radare2rc"; + const char *global_rc = r_str_r2_prefix (R2_GLOBAL_RC); if (r_file_exists (global_rc)) { (void)r_core_run_script (&r, global_rc); } + free (global_rc); } // only analyze if file contains entrypoint { diff --git a/libr/include/r_userconf.h.acr b/libr/include/r_userconf.h.acr index 4c17c4da70..5c4e927951 100644 --- a/libr/include/r_userconf.h.acr +++ b/libr/include/r_userconf.h.acr @@ -17,6 +17,7 @@ #define R2_PLUGINS "@PLUGINS@" #define R2_EXTRAS "@EXTRAS@" #define R2_BINDINGS "@BINDINGS@" +#define R2_DATDIR_R2 "@DATADIR_R2@" #define R2_SDB "@SDB@" #define R2_ZIGNS "@ZIGNS@" #define R2_THEMES "@THEMES@" @@ -43,6 +44,7 @@ #define R2_EXTRAS "lib/radare2-extras/" R2_VERSION #define R2_BINDINGS "lib/radare2-bindings/" R2_VERSION #endif +#define R2_DATDIR_R2 R_JOIN_2_PATHS ("share", "radare2") #define R2_SDB R_JOIN_3_PATHS ("share", "radare2", R2_VERSION) #define R2_ZIGNS R_JOIN_4_PATHS ("share", "radare2", R2_VERSION, "zigns") #define R2_THEMES R_JOIN_4_PATHS ("share", "radare2", R2_VERSION, "cons") @@ -71,10 +73,11 @@ #define R2_HOME_BINRC R_JOIN_2_PATHS (R2_HOME_DATADIR, "rc.d") #define R2_HOME_BIN R_JOIN_3_PATHS (R2_HOME_DATADIR, "prefix", "bin") +#define R2_HOME_HISTORY R_JOIN_2_PATHS (R2_HOME_CACHEDIR, "history") + #define R2_HOME_RC R_JOIN_2_PATHS (R2_HOME_CONFIGDIR, "radare2rc") #define R2_HOME_RC_DIR R_JOIN_2_PATHS (R2_HOME_CONFIGDIR, "radare2rc.d") - -#define R2_HOME_HISTORY R_JOIN_2_PATHS (R2_HOME_CACHEDIR, "history") +#define R2_GLOBAL_RC R_JOIN_2_PATHS (R2_DATDIR_R2, "radare2rc") #define HAVE_LIB_MAGIC @HAVE_LIB_MAGIC@ #define USE_LIB_MAGIC @USE_LIB_MAGIC@ diff --git a/meson.build b/meson.build index 94ba8fc1c7..a6b6c6a4de 100644 --- a/meson.build +++ b/meson.build @@ -253,8 +253,10 @@ userconf.set('HAVE_OPENSSL', use_sys_openssl.to_int()) userconf.set('HAVE_FORK', 1) userconf.set('WITH_GPL', 1) if host_machine.system() == 'windows' + userconf.set('DATADIR_R2', r2_datdir) userconf.set('HAVE_JEMALLOC', 0) else + userconf.set('DATADIR_R2', join_paths(get_option('datadir'), 'radare2')) userconf.set('HAVE_JEMALLOC', 1) endif if cc.has_header_symbol('sys/personality.h', 'ADDR_NO_RANDOMIZE')