SDL icon indicating copy to clipboard operation
SDL copied to clipboard

SDL_GlobDirectory causes a crash in android

Open mccakit opened this issue 6 months ago • 2 comments

This snippet causes a crash in android, because the function doesn't return anything and I get a divide by zero error later down the line, but in windows and wasm it works fine

    char** rawFiles = SDL_GlobDirectory("nameless_deity", "*.png", SDL_GLOB_CASEINSENSITIVE, nullptr);
    std::vector<std::string> helper;
    for (char** ptr = rawFiles; *ptr != nullptr; ++ptr)
    {
        helper.push_back(*ptr);
    }
    }

mccakit avatar Jun 05 '25 22:06 mccakit

Certain filesystem and path functions on Android are not implemented. Where do you expect the directory search/glob to be performed in that case? Inside APK's assets/ folder, or somewhere on actual device filesystem (/data, /usr/)?

MrOnlineCoder avatar Jun 10 '25 12:06 MrOnlineCoder

Assets directory would be nice, as sdl_load already uses that

mccakit avatar Jun 10 '25 12:06 mccakit

This is the same problem as #13050 (SDL_GlobDirectory uses SDL_EnumerateDirectory and SDL_GetPathInfo under the hood).

icculus avatar Jul 11 '25 17:07 icculus