Skip to content

Commit e1ae1e1

Browse files
committed
switch to libretro file streams & fix exception branch
1 parent 1b506cb commit e1ae1e1

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

libretro.c

+4-3
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ read_m3u(const char *file)
6666
{
6767
char line[PATH_MAX];
6868
char name[PATH_MAX];
69-
FILE *f = fopen(file, "r");
69+
RFILE *f = filestream_open(file, RETRO_VFS_FILE_ACCESS_READ, RETRO_VFS_FILE_ACCESS_HINT_NONE);
7070

7171
g_DISK_TOTAL = 0;
7272

@@ -76,7 +76,7 @@ read_m3u(const char *file)
7676
return false;
7777
}
7878

79-
while (fgets(line, sizeof(line), f) && g_DISK_TOTAL <= M3U_MAX_FILE)
79+
while (filestream_gets(f, line, sizeof(line)) && g_DISK_TOTAL <= M3U_MAX_FILE)
8080
{
8181
if (line[0] == '#')
8282
continue;
@@ -98,6 +98,7 @@ read_m3u(const char *file)
9898
if (strlen(g_ROMS_DIR) + strlen(line) + 1 >= PATH_MAX)
9999
{
100100
retro_log_printf_cb(RETRO_LOG_ERROR, "Path too long\n");
101+
filestream_close(f);
101102
return false;
102103
}
103104

@@ -109,7 +110,7 @@ read_m3u(const char *file)
109110
}
110111
}
111112

112-
fclose(f);
113+
filestream_close(f);
113114
return (g_DISK_TOTAL != 0);
114115
}
115116

0 commit comments

Comments
 (0)