From c24f7d245300810f55631aeb8bd098fe9fba62f8 Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Mon, 7 Oct 2024 12:44:49 +0100 Subject: [PATCH] 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 --- src/SDL.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/SDL.c b/src/SDL.c index edacc86db0..c612900489 100644 --- a/src/SDL.c +++ b/src/SDL.c @@ -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 : ""); + value = SDL_GetAppMetadataProperty(SDL_PROP_APP_METADATA_IDENTIFIER_STRING); + SDL_LogInfo(SDL_LOG_CATEGORY_SYSTEM, "App ID: %s", value ? value : ""); + + done_info = true; + } } static void SDL_QuitMainThread(void)