From eafa02812e49cfb612208e3b1199a64e56354b59 Mon Sep 17 00:00:00 2001 From: Pere Pujal i Carabantes Date: Sat, 16 Jan 2021 00:43:46 +0100 Subject: [PATCH] Magic tools: Android forbids restricted users from some standard dirs, detecting custom ones at runtime. --- src/tuxpaint.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/tuxpaint.c b/src/tuxpaint.c index 90fa8835c..ec1f48d98 100644 --- a/src/tuxpaint.c +++ b/src/tuxpaint.c @@ -18942,7 +18942,15 @@ static void load_magic_plugins(void) for (plc = 0; plc < NUM_MAGIC_PLACES; plc++) { if (plc == MAGIC_PLACE_GLOBAL) - place = strdup(MAGIC_PREFIX); + { +#if defined (__ANDROID__) + /* Need this at runtime as Android installs on different locations depending on the user */ + place = strdup(SDL_AndroidGetInternalStoragePath()); + strcpy(strstr(place, "/files"), "/lib/"); +#else + place = strdup(MAGIC_PREFIX); +#endif + } else if (plc == MAGIC_PLACE_LOCAL) place = get_fname("plugins/", DIR_DATA); #ifdef __APPLE__