From 95e3bd22819aafc32dd1ae7b9a8f3c28ee240a80 Mon Sep 17 00:00:00 2001 From: Arignir Date: Fri, 8 Mar 2024 02:39:59 +0100 Subject: [PATCH] Use absolute paths instead of relative ones for the "recent roms" list. --- source/app/config.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/source/app/config.c b/source/app/config.c index 8b16640..a635a0d 100644 --- a/source/app/config.c +++ b/source/app/config.c @@ -393,15 +393,20 @@ app_config_push_recent_rom( char const *rom_path ) { char *new_recent_roms[MAX_RECENT_ROMS]; + char abs_path[4096]; + char const *path; int32_t i; int32_t j; + path = realpath(rom_path, abs_path) ?: rom_path; + new_recent_roms[0] = strdup(path); + memset(new_recent_roms, 0, sizeof(new_recent_roms)); - new_recent_roms[0] = strdup(rom_path); + new_recent_roms[0] = strdup(abs_path); j = 0; for (i = 1; i < MAX_RECENT_ROMS && j < MAX_RECENT_ROMS; ++j) { - if (!app->file.recent_roms[j] || strcmp(app->file.recent_roms[j], rom_path)) { + if (!app->file.recent_roms[j] || strcmp(app->file.recent_roms[j], path)) { new_recent_roms[i] = app->file.recent_roms[j]; ++i; } else {