Log app ID as SYSTEM/INFO during initialization

This is not shown by default, but will be shown when using
SDL_LOGGING=system=info or higher, where it will hopefully nudge app
authors towards initializing this information.

Signed-off-by: Simon McVittie <smcv@collabora.com>
This commit is contained in:
Simon McVittie 2024-10-07 12:44:49 +01:00 committed by Ryan C. Gordon
parent e7ee92e822
commit c24f7d2453

View file

@ -254,10 +254,25 @@ void SDL_SetMainReady(void)
// Initialize all the subsystems that require initialization before threads start
void SDL_InitMainThread(void)
{
static bool done_info = false;
SDL_InitTLSData();
SDL_InitEnvironment();
SDL_InitTicks();
SDL_InitFilesystem();
if (!done_info) {
const char *value;
value = SDL_GetAppMetadataProperty(SDL_PROP_APP_METADATA_NAME_STRING);
SDL_LogInfo(SDL_LOG_CATEGORY_SYSTEM, "App name: %s", value);
value = SDL_GetAppMetadataProperty(SDL_PROP_APP_METADATA_VERSION_STRING);
SDL_LogInfo(SDL_LOG_CATEGORY_SYSTEM, "App version: %s", value ? value : "<unspecified>");
value = SDL_GetAppMetadataProperty(SDL_PROP_APP_METADATA_IDENTIFIER_STRING);
SDL_LogInfo(SDL_LOG_CATEGORY_SYSTEM, "App ID: %s", value ? value : "<unspecified>");
done_info = true;
}
}
static void SDL_QuitMainThread(void)