Parse M3U file locations to fully qualified paths

Posted by Guy on Stack Overflow See other posts from Stack Overflow or by Guy
Published on 2011-06-23T13:44:52Z Indexed on 2011/06/23 16:22 UTC
Read the original article Hit count: 440

Filed under:
|

I would like to parse the file location information in an M3U playlist into fully qualified paths. The possible formats in M3U files seem to be:

c:\mydir\songs\tune.mp3

\songs\tune.mp3

..\songs\tune.mp3

For the first example, just leave it alone. For the second add the directory that the playlist resides in so it would become c:\playlists\songs\tune.mp3 and the same for the third case so it would also become: c:\playlists\songs\tune.mp3.

I'm using vb under VS2008 and I can't find a way to recognise each of the potential location formats in the M3U file. System.IO.Path offers no solution that I can find. I've searched extensively for terms like "convert relative path to absolute" but no luck.

Any advice appreciated.

Thanks.

© Stack Overflow or respective owner

Related posts about vb.net

Related posts about m3u