Fixed: Unable to patch when Ryzom was located on a mounted FS

--HG--
branch : hotfix
This commit is contained in:
kervala 2015-02-14 12:52:57 +01:00
parent 165524d1df
commit 6e1abd80d3
2 changed files with 6 additions and 6 deletions

View file

@ -1068,12 +1068,12 @@ float CPatchManager::getCurrentFileProgress() const
} }
// **************************************************************************** // ****************************************************************************
void CPatchManager::setRWAccess (const string &filename) void CPatchManager::setRWAccess (const string &filename, bool bThrowException)
{ {
ucstring s = CI18N::get("uiSetAttrib") + " " + filename; ucstring s = CI18N::get("uiSetAttrib") + " " + filename;
setState(true, s); setState(true, s);
if (!NLMISC::CFile::setRWAccess(filename)) if (!NLMISC::CFile::setRWAccess(filename) && bThrowException)
{ {
s = CI18N::get("uiAttribErr") + " " + filename + " (" + toString(errno) + "," + strerror(errno) + ")"; s = CI18N::get("uiAttribErr") + " " + filename + " (" + toString(errno) + "," + strerror(errno) + ")";
setState(true, s); setState(true, s);
@ -1351,7 +1351,7 @@ void CPatchManager::downloadFileWithCurl (const string &source, const string &de
// create the local file // create the local file
if (NLMISC::CFile::fileExists(dest)) if (NLMISC::CFile::fileExists(dest))
{ {
setRWAccess(dest); setRWAccess(dest, false);
NLMISC::CFile::deleteFile(dest.c_str()); NLMISC::CFile::deleteFile(dest.c_str());
} }
FILE *fp = fopen (dest.c_str(), "wb"); FILE *fp = fopen (dest.c_str(), "wb");
@ -1492,7 +1492,7 @@ void CPatchManager::decompressFile (const string &filename)
} }
string dest = filename.substr(0, filename.size ()-4); string dest = filename.substr(0, filename.size ()-4);
setRWAccess(dest); setRWAccess(dest, false);
//if(isVerboseLog()) nlinfo("Calling fopen('%s','wb')", dest.c_str()); //if(isVerboseLog()) nlinfo("Calling fopen('%s','wb')", dest.c_str());
FILE *fp = fopen (dest.c_str(), "wb"); FILE *fp = fopen (dest.c_str(), "wb");
if (fp == NULL) if (fp == NULL)
@ -1566,7 +1566,7 @@ void CPatchManager::applyDate (const string &sFilename, uint32 nDate)
{ {
// _utimbuf utb; // _utimbuf utb;
// utb.actime = utb.modtime = nDate; // utb.actime = utb.modtime = nDate;
setRWAccess(sFilename); setRWAccess(sFilename, false);
ucstring s = CI18N::get("uiChangeDate") + " " + NLMISC::CFile::getFilename(sFilename) + " " + toString(NLMISC::CFile::getFileModificationDate (sFilename)) + ucstring s = CI18N::get("uiChangeDate") + " " + NLMISC::CFile::getFilename(sFilename) + " " + toString(NLMISC::CFile::getFileModificationDate (sFilename)) +
" -> " + toString(nDate); " -> " + toString(nDate);
setState(true,s); setState(true,s);

View file

@ -302,7 +302,7 @@ private:
/// Read the description of the highest client version file found /// Read the description of the highest client version file found
void readClientVersionAndDescFile(); void readClientVersionAndDescFile();
void setRWAccess (const std::string &filename); void setRWAccess (const std::string &filename, bool bThrowException=true);
std::string deleteFile (const std::string &filename, bool bThrowException=true, bool bWarning=true); std::string deleteFile (const std::string &filename, bool bThrowException=true, bool bWarning=true);