mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-08-13 16:45:49 -04:00
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:
parent
97a1ac3422
commit
4d278ac414
4 changed files with 53 additions and 1 deletions
|
@ -788,7 +788,15 @@ void p3GroupDistrib::locked_publishPendingMsgs()
|
|||
mPendingPublish.clear();
|
||||
delete streamer;
|
||||
|
||||
#ifdef WIN32
|
||||
std::wstring from,to ;
|
||||
for(std::string::const_iterator it = filenametmp.begin(); it!=filenametmp.end();++it) from += *it;
|
||||
for(std::string::const_iterator it = filename .begin(); it!=filename .end();++it) to += *it;
|
||||
|
||||
if(!MoveFileEx(from.c_str(), to.c_str(), MOVEFILE_REPLACE_EXISTING))
|
||||
#else
|
||||
if(0 != rename(filenametmp.c_str(),filename.c_str()))
|
||||
#endif
|
||||
std::cerr << "Could not rename file " << filenametmp << " into " << filename << std::endl ;
|
||||
else
|
||||
std::cerr << "Successfull wrote file " << filename << std::endl ;
|
||||
|
@ -925,7 +933,15 @@ void p3GroupDistrib::publishDistribGroups()
|
|||
/* cleanup */
|
||||
delete streamer;
|
||||
|
||||
#ifdef WIN32
|
||||
std::wstring from,to ;
|
||||
for(std::string::const_iterator it = filenametmp.begin(); it!=filenametmp.end();++it) from += *it;
|
||||
for(std::string::const_iterator it = filename .begin(); it!=filename .end();++it) to += *it;
|
||||
|
||||
if(!MoveFileEx(from.c_str(), to.c_str(), MOVEFILE_REPLACE_EXISTING))
|
||||
#else
|
||||
if(0 != rename(filenametmp.c_str(),filename.c_str()))
|
||||
#endif
|
||||
std::cerr << "Could not rename file " << filenametmp << " into " << filename << std::endl ;
|
||||
else
|
||||
std::cerr << "Successfull wrote file " << filename << std::endl ;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue