Skip to content

Commit 7c27658

Browse files
committed
rg_storage: Do not log ENOENT errors
They're polluting the logs and entirely expected. The other solution to prevent this spam is to call rg_storage_exists() all the time, but it will slow down accesses quite a bit due to walking the FAT twice...
1 parent e845c74 commit 7c27658

File tree

3 files changed

+11
-3
lines changed

3 files changed

+11
-3
lines changed

components/retro-go/rg_storage.c

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -357,12 +357,17 @@ bool rg_storage_scandir(const char *path, rg_scandir_cb_t *callback, void *arg,
357357

358358
DIR *dir = opendir(path);
359359
if (!dir)
360+
{
361+
if (errno != ENOENT) // Only log unusual errors. Path not found isn't unusual.
362+
RG_LOGE("Opendir failed (%d): '%s'", errno, path);
360363
return false;
364+
}
361365

362366
// We allocate on heap in case we go recursive through rg_storage_delete
363367
rg_scandir_t *result = calloc(1, sizeof(rg_scandir_t));
364368
if (!result)
365369
{
370+
RG_LOGE("Memory allocation failed: '%s'", path);
366371
closedir(dir);
367372
return false;
368373
}
@@ -456,7 +461,8 @@ bool rg_storage_read_file(const char *path, void **data_out, size_t *data_len, u
456461
FILE *fp = fopen(path, "rb");
457462
if (!fp)
458463
{
459-
RG_LOGE("Fopen failed (%d): '%s'", errno, path);
464+
if (errno != ENOENT) // Only log unusual errors. Path not found isn't unusual.
465+
RG_LOGE("Fopen failed (%d): '%s'", errno, path);
460466
return false;
461467
}
462468

@@ -574,7 +580,8 @@ bool rg_storage_unzip_file(const char *zip_path, const char *filter, void **data
574580
FILE *fp = fopen(zip_path, "rb");
575581
if (!fp)
576582
{
577-
RG_LOGE("Fopen failed (%d): '%s'", errno, zip_path);
583+
if (errno != ENOENT) // Only log unusual errors. Path not found isn't unusual.
584+
RG_LOGE("Fopen failed (%d): '%s'", errno, zip_path);
578585
return false;
579586
}
580587

components/retro-go/rg_surface.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -314,6 +314,7 @@ rg_surface_t *rg_surface_load_image_file(const char *filename, uint32_t flags)
314314
return img;
315315
}
316316

317+
// RG_LOGE("Image loading failed: '%s'", filename);
317318
return NULL;
318319
}
319320

launcher/main/gui.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -631,7 +631,7 @@ void gui_load_preview(tab_t *tab)
631631

632632
if (!tab->preview && file->checksum && (show_missing_cover || errors))
633633
{
634-
RG_LOGI("No image found for '%s'\n", file->name);
634+
RG_LOGD("No image found for '%s'\n", file->name);
635635
gui_set_status(tab, NULL, errors ? "Bad cover" : "No cover");
636636
// gui_draw_status(tab);
637637
// tab->preview = gui_get_image("cover", file->app);

0 commit comments

Comments
 (0)