From e657397f666824b0ce7a96de350a7fdb31a4e8f8 Mon Sep 17 00:00:00 2001 From: Michael Goddard Date: Fri, 20 Apr 2012 15:18:04 +1000 Subject: Adjust to changed QUrl::isRelative() semantics. Paths with a leading slash were previously considered relative (with no scheme) but now they aren't. So take the opportunity to tweak the path resolution code Change-Id: I7b02cb85403ebb151dba274db0c05459ef536f18 Reviewed-by: Lev Zelenskiy Reviewed-by: Ling Hu --- src/multimedia/playback/playlistfileparser.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'src/multimedia/playback/playlistfileparser.cpp') diff --git a/src/multimedia/playback/playlistfileparser.cpp b/src/multimedia/playback/playlistfileparser.cpp index 11fe5a232..d06f31304 100644 --- a/src/multimedia/playback/playlistfileparser.cpp +++ b/src/multimedia/playback/playlistfileparser.cpp @@ -148,12 +148,22 @@ public: QUrl expandToFullPath(const QUrl& root, const QString& line) { + // On Linux, backslashes are not converted to forward slashes :/ + if (line.startsWith(QLatin1String("//")) || line.startsWith(QLatin1String("\\\\"))) { + // Network share paths are not resolved + return QUrl::fromLocalFile(line); + } + QUrl url(line); - if (url.isRelative()) { + if (url.scheme().isEmpty()) { + // Resolve it relative to root if (root.isLocalFile()) return root.resolved(QUrl::fromLocalFile(line)); else return root.resolved(url); + } else if (url.scheme().length() == 1) { + // Assume it's a drive letter for a Windows path + url = QUrl::fromLocalFile(line); } return url; -- cgit v1.2.3