Skip to content

Commit

Permalink
switch to libretro file streams & fix exception branch
Browse files Browse the repository at this point in the history
  • Loading branch information
dszakallas committed May 1, 2024
1 parent 1b506cb commit e1ae1e1
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions libretro.c
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ read_m3u(const char *file)
{
char line[PATH_MAX];
char name[PATH_MAX];
FILE *f = fopen(file, "r");
RFILE *f = filestream_open(file, RETRO_VFS_FILE_ACCESS_READ, RETRO_VFS_FILE_ACCESS_HINT_NONE);

g_DISK_TOTAL = 0;

Expand All @@ -76,7 +76,7 @@ read_m3u(const char *file)
return false;
}

while (fgets(line, sizeof(line), f) && g_DISK_TOTAL <= M3U_MAX_FILE)
while (filestream_gets(f, line, sizeof(line)) && g_DISK_TOTAL <= M3U_MAX_FILE)
{
if (line[0] == '#')
continue;
Expand All @@ -98,6 +98,7 @@ read_m3u(const char *file)
if (strlen(g_ROMS_DIR) + strlen(line) + 1 >= PATH_MAX)
{
retro_log_printf_cb(RETRO_LOG_ERROR, "Path too long\n");
filestream_close(f);
return false;
}

Expand All @@ -109,7 +110,7 @@ read_m3u(const char *file)
}
}

fclose(f);
filestream_close(f);
return (g_DISK_TOTAL != 0);
}

Expand Down

0 comments on commit e1ae1e1

Please sign in to comment.