aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartijn Kaijser <martijn@xbmc.org>2016-01-20 13:11:49 +0100
committerMartijn Kaijser <martijn@xbmc.org>2016-01-20 13:11:49 +0100
commit232a184ae7cdf06bfd27de56a64ac7c2e17e4859 (patch)
treef2848848e4cdd8ce795866b1bb01030544d4578d
parent762396bf2376e3853c21b984ff39e76dfc094237 (diff)
parentf38fc019d2305ba977fea0efa3eb30c5c473ea12 (diff)
Merge pull request #8920 from MartijnKaijser/8898
[filesystem] handle resource paths as file paths
-rw-r--r--xbmc/URL.cpp3
-rw-r--r--xbmc/filesystem/ResourceFile.cpp7
2 files changed, 7 insertions, 3 deletions
diff --git a/xbmc/URL.cpp b/xbmc/URL.cpp
index b23080d545..f353a344bd 100644
--- a/xbmc/URL.cpp
+++ b/xbmc/URL.cpp
@@ -153,7 +153,8 @@ void CURL::Parse(const std::string& strURL1)
IsProtocol("virtualpath") ||
IsProtocol("multipath") ||
IsProtocol("filereader") ||
- IsProtocol("special")
+ IsProtocol("special") ||
+ IsProtocol("resource")
)
{
SetFileName(strURL.substr(iPos));
diff --git a/xbmc/filesystem/ResourceFile.cpp b/xbmc/filesystem/ResourceFile.cpp
index 47f623af3c..8bd5fe0d29 100644
--- a/xbmc/filesystem/ResourceFile.cpp
+++ b/xbmc/filesystem/ResourceFile.cpp
@@ -49,7 +49,11 @@ bool CResourceFile::TranslatePath(const CURL &url, std::string &translatedPath)
return false;
// the share name represents an identifier that can be mapped to an addon ID
- std::string addonId = url.GetHostName();
+ std::string addonId = url.GetShareName();
+ std::string filePath;
+ if (url.GetFileName().length() > addonId.length())
+ filePath = url.GetFileName().substr(addonId.size() + 1);
+
if (addonId.empty())
return false;
@@ -61,7 +65,6 @@ bool CResourceFile::TranslatePath(const CURL &url, std::string &translatedPath)
if (resource == NULL)
return false;
- std::string filePath = url.GetFileName();
if (!resource->IsAllowed(filePath))
return false;