Skip to content

Commit

Permalink
Use absolute paths instead of relative ones for the "recent roms" list.
Browse files Browse the repository at this point in the history
  • Loading branch information
Arignir committed Mar 8, 2024
1 parent 4bd7759 commit 95e3bd2
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions source/app/config.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 95e3bd2

Please sign in to comment.