diff options
author | Memphiz <memphis@machzwo.de> | 2013-12-09 06:44:04 -0800 |
---|---|---|
committer | Memphiz <memphis@machzwo.de> | 2013-12-09 06:44:04 -0800 |
commit | 15bb590e46f1e571d3dd5df3d833801ee98ebde6 (patch) | |
tree | 04a760e428c60b3dc097c2632b56b0d60f2beb7b | |
parent | 9e4195ab0da496ea0d6d0ac38a83bb02e3aa336f (diff) | |
parent | f6dd667309e35b78befc8fb0949dfcce5b323ee5 (diff) |
Merge pull request #3772 from nigeljonez/nfsfix-14727
[nfs] Fix syncing issue from Trac #14727
-rw-r--r-- | xbmc/filesystem/NFSFile.cpp | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/xbmc/filesystem/NFSFile.cpp b/xbmc/filesystem/NFSFile.cpp index 0b900497c1..11bc379ad9 100644 --- a/xbmc/filesystem/NFSFile.cpp +++ b/xbmc/filesystem/NFSFile.cpp @@ -95,11 +95,13 @@ std::list<std::string> CNfsConnection::GetExportList(const CURL &url) for(tmp = exportlist; tmp!=NULL; tmp=tmp->ex_next) { std::string exportStr = std::string(tmp->ex_dir); - URIUtils::AddSlashAtEnd(exportStr); + retList.push_back(exportStr); } gNfsConnection.GetImpl()->mount_free_export_list(exportlist); + retList.sort(); + retList.reverse(); } return retList; @@ -248,7 +250,7 @@ bool CNfsConnection::splitUrlIntoExportAndPath(const CURL& url,CStdString &expor //GetFileName returns path without leading "/" //but we need it because the export paths start with "/" //and path.Find(*it) wouldn't work else - if(!path.empty() && path[0] != '/') + if(path[0] != '/') { path = "/" + path; } @@ -260,14 +262,23 @@ bool CNfsConnection::splitUrlIntoExportAndPath(const CURL& url,CStdString &expor //if path starts with the current export path if(StringUtils::StartsWith(path, *it)) { + //its possible that StartsWith may not find the correct match first + //as an example, if /path/ & and /path/sub/ are exported, but + //the user specifies the path /path/subdir/ (from /path/ export). + //If the path is longer than the exportpath, make sure / is next. + if( (path.length() > (*it).length()) && + (path[(*it).length()] != '/') && (*it) != "/") + continue; exportPath = *it; //handle special case where root is exported //in that case we don't want to stripp off to //much from the path - if( exportPath == "/" ) - relativePath = "//" + path.substr(exportPath.length()-1); - else + if( exportPath == path ) + relativePath = "//"; + else if( exportPath == "/" ) relativePath = "//" + path.substr(exportPath.length()); + else + relativePath = "//" + path.substr(exportPath.length()+1); ret = true; break; } |