From 8499dc57c526e4a23c5ea6c58fdf634d6d625c17 Mon Sep 17 00:00:00 2001 From: Bill Kendrick Date: Sat, 22 Feb 2025 12:03:18 -0800 Subject: [PATCH] dirwalk.c: Add debug option to show opendir() failures --- src/dirwalk.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/src/dirwalk.c b/src/dirwalk.c index d5f5363fc..a7ed5d366 100644 --- a/src/dirwalk.c +++ b/src/dirwalk.c @@ -1,7 +1,7 @@ /* dirwalk.c - Copyright (c) 2009-2023 + Copyright (c) 2009-2025 https://tuxpaint.org/ This program is free software; you can redistribute it and/or modify @@ -19,9 +19,11 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA (See COPYING.txt) - Last modified: April 30, 2023 + Last modified: February 22, 2025 */ +/* #define DIRWALK_DEBUG */ + #include #include #ifndef __USE_GNU @@ -354,6 +356,7 @@ void tp_ftw(SDL_Surface *screen, SDL_Texture *texture, /* Open the directory: */ d = opendir(dir); + #ifdef __ANDROID__ char *di; AAssetDir *adir; @@ -365,11 +368,21 @@ void tp_ftw(SDL_Surface *screen, SDL_Texture *texture, di = strndup(dir, dlen); adir = open_asset_dir(di); if (!adir) + { +#ifdef DIRWALK_DEBUG + printf("tp_ftw() can't opendir(%s)\n", dir); +#endif return; + } } #else if (!d) + { +#ifdef DIRWALK_DEBUG + printf("tp_ftw() can't opendir(%s)\n", dir); +#endif return; + } #endif for (;;)