Skip to content

Commit

Permalink
demux_playlist: fix comparison for current file if it's in current dir
Browse files Browse the repository at this point in the history
When the file is in the current working directory, stream->path points
directly to the path, while path includes "./". So strip it to make the
comparison work.

Neither include "./" in any other situation.

Fixes: c201c48
  • Loading branch information
llyyr committed Oct 23, 2024
1 parent 3d443cb commit 6c610e0
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions demux/demux_playlist.c
Original file line number Diff line number Diff line change
Expand Up @@ -416,6 +416,11 @@ static bool test_path(struct pl_parser *p, char *path, int autocreate)
if (autocreate & AUTO_ANY)
return true;

// When opening a file from cwd, 'path' starts with "./" while stream->path
// does not. Strip it to make the comparison work.
if (strncmp(path, "./", 2) == 0 && !mp_path_is_absolute(bstr0(p->real_stream->path)))
path += 2;

if (!strcmp(path, p->real_stream->path))
return true;

Expand Down

0 comments on commit 6c610e0

Please sign in to comment.