rendered paste bodyIndex: xbmc/FileSystem/File.cpp===================================================================--- xbmc/FileSystem/File.cpp (revision 19724)+++ xbmc/FileSystem/File.cpp (working copy)@@ -26,7 +26,6 @@ #include "DirectoryCache.h" #include "FileCache.h" #include "FileItem.h"-#include "SpecialProtocol.h" #ifndef _LINUX #include "utils/Win32Exception.h"@@ -141,50 +140,40 @@ } CFile newFile;- CStdString strDirectory, strDest2;- if (CUtil::IsSpecial(strDest))- strDest2 = CSpecialProtocol::TranslatePath(strDest);- else- strDest2 = strDest;- if (CUtil::IsHD(strDest2)) // create possible missing dirs+ if (CUtil::IsHD(strDest)) // create possible missing dirs { vector<CStdString> tokens;- CUtil::GetDirectory(strDest2,strDirectory);+ CStdString strDirectory;+ CUtil::GetDirectory(strDest,strDirectory); CUtil::RemoveSlashAtEnd(strDirectory); // for the test below if (!(strDirectory.size() == 2 && strDirectory[1] == ':')) {-#ifndef _LINUX - CUtil::Tokenize(strDirectory,tokens,"\\");- CStdString strCurrPath;- // If the directory has a / at the beginning, don't forget it- if (strDirectory[0] == '\\')- {- strCurrPath += "\\";- }- for (vector<CStdString>::iterator iter=tokens.begin();iter!=tokens.end();++iter)- {- strCurrPath += *iter+"\\";- CDirectory::Create(strCurrPath);- }+ CURL url(strDirectory);+ CStdString pathsep;+#ifndef _LINUX+ pathsep = "\\"; #else- CUtil::Tokenize(strDirectory,tokens,"/");+ pathsep = "/";+#endif+ CUtil::Tokenize(url.GetFileName(),tokens,pathsep.c_str()); CStdString strCurrPath;- // If the directory has a / at the beginning, don't forget it- if (strDirectory[0] == '/')- {- strCurrPath += "/";- }+ // Handle special+ if (!url.GetProtocol().IsEmpty()) {+ pathsep = "/";+ strCurrPath += url.GetProtocol() + "://";+ } // If the directory has a / at the beginning, don't forget it+ else if (strDirectory[0] == pathsep[0])+ strCurrPath += pathsep; for (vector<CStdString>::iterator iter=tokens.begin();iter!=tokens.end();++iter) {- strCurrPath += *iter+"/";+ strCurrPath += *iter+pathsep; CDirectory::Create(strCurrPath); }-#endif } }- if (CFile::Exists(strDest2))- CFile::Delete(strDest2);- if (!newFile.OpenForWrite(strDest2, true)) // overwrite always+ if (CFile::Exists(strDest))+ CFile::Delete(strDest);+ if (!newFile.OpenForWrite(strDest, true)) // overwrite always { file.Close(); return false;@@ -240,7 +229,7 @@ if (iWrite != iRead) {- CLog::Log(LOGERROR, "%s - Failed write to file %s", __FUNCTION__, strDest2.c_str());+ CLog::Log(LOGERROR, "%s - Failed write to file %s", __FUNCTION__, strDest.c_str()); break; } @@ -281,7 +270,7 @@ /* verify that we managed to completed the file */ if (llPos != llFileSizeOrg) {- CFile::Delete(strDest2);+ CFile::Delete(strDest); return false; } return true;