win32 compatibility for moving files

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@1099 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
csoler 2009-03-26 13:24:27 +00:00
parent 97a1ac3422
commit 4d278ac414
4 changed files with 53 additions and 1 deletions

View file

@ -289,7 +289,15 @@ bool p3MsgService::saveConfiguration()
if(!written)
return false ;
#ifdef WIN32
std::wstring from,to ;
for(std::string::const_iterator it = msgfiletmp.begin(); it!=msgfiletmp.end();++it) from += *it;
for(std::string::const_iterator it = msgfile .begin(); it!=msgfile .end();++it) to += *it;
if(!MoveFileEx(from.c_str(), to.c_str(), MOVEFILE_REPLACE_EXISTING))
#else
if(0 != rename(msgfiletmp.c_str(),msgfile.c_str()))
#endif
return false ;
return true;