Skip to content

Commit

Permalink
Popularize TERMUX_PREFIX
Browse files Browse the repository at this point in the history
  • Loading branch information
radare authored and trufae committed Jun 17, 2021
1 parent 9ec6ffd commit d109d59
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
8 changes: 6 additions & 2 deletions libr/core/cconfig.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
#include <r_core.h>
#include <r_types_base.h>

#ifndef TERMUX_PREFIX
#define TERMUX_PREFIX "/data/data/com.termux/files/usr"
#endif

#define NODECB(w,x,y) r_config_set_cb (cfg,w,x,y)
#define NODEICB(w,x,y) r_config_set_i_cb (cfg,w,x,y)
#define SETDESC(x,y) r_config_node_desc (x,y)
Expand Down Expand Up @@ -3719,8 +3723,8 @@ R_API int r_core_config_init(RCore *core) {
#else
if (r_file_exists ("/usr/bin/openURL")) { // iOS ericautils
r_config_set (cfg, "http.browser", "/usr/bin/openURL");
} else if (r_file_exists ("@TERMUX_PREFIX@/bin/termux-open")) {
r_config_set (cfg, "http.browser", "@TERMUX_PREFIX@/bin/termux-open");
} else if (r_file_exists (TERMUX_PREFIX "/bin/termux-open")) {
r_config_set (cfg, "http.browser", TERMUX_PREFIX "/bin/termux-open");
} else if (r_file_exists ("/system/bin/toolbox")) {
r_config_set (cfg, "http.browser",
"LD_LIBRARY_PATH=/system/lib am start -a android.intent.action.VIEW -d");
Expand Down
8 changes: 5 additions & 3 deletions libr/util/file.c
Original file line number Diff line number Diff line change
Expand Up @@ -1232,9 +1232,11 @@ R_API char *r_file_tmpdir(void) {
}
if (!path) {
#if __ANDROID__
path = strdup ("/data/local/tmp");
// path = strdup ("/data/data/com.termux/files/usr/tmp");
// path = strdup ("@TERMUX_PREFIX@/tmp");
if (r_file_is_directory (TERMUX_PREFIX "/tmp")) {
path = strdup (TERMUX_PREFIX "/tmp");
} else {
path = strdup ("/data/local/tmp");
}
#else
path = strdup ("/tmp");
#endif
Expand Down

0 comments on commit d109d59

Please sign in to comment.