playback.c use file_exists rather than open to check for bad files

the worst case is really slow for open

Change-Id: Ifcfe366ad9bee7ff43a0572e52f15b5c6f608288
This commit is contained in:
William Wilgus 2022-03-11 03:16:51 -05:00 committed by William Wilgus
parent 603412f447
commit 359c66982f

View file

@ -1907,11 +1907,13 @@ static int audio_load_track(void)
break;
/* Test for broken playlists by probing for the files */
fd = open(path, O_RDONLY);
if (fd >= 0)
break;
logf("Open failed");
if (file_exists(path))
{
fd = open(path, O_RDONLY);
if (fd >= 0)
break;
}
logf("Open failed %s", path);
/* only skip if failed track has a successor in playlist */
if (!playlist_peek(playlist_peek_offset + 1, NULL, 0))