Merge pull request #19 from pch957/patch1
filesystem::rename() can handle file from cross device
This commit is contained in:
commit
b358b641d4
1 changed files with 7 additions and 2 deletions
|
|
@ -234,8 +234,13 @@ namespace fc {
|
||||||
try {
|
try {
|
||||||
boost::filesystem::rename( boost::filesystem::path(f), boost::filesystem::path(t) );
|
boost::filesystem::rename( boost::filesystem::path(f), boost::filesystem::path(t) );
|
||||||
} catch ( boost::system::system_error& e ) {
|
} catch ( boost::system::system_error& e ) {
|
||||||
FC_THROW( "Rename from ${srcfile} to ${dstfile} failed because ${reason}",
|
try{
|
||||||
("srcfile",f)("dstfile",t)("reason",e.what() ) );
|
boost::filesystem::copy( boost::filesystem::path(f), boost::filesystem::path(t) );
|
||||||
|
boost::filesystem::remove( boost::filesystem::path(f));
|
||||||
|
} catch ( boost::system::system_error& e ) {
|
||||||
|
FC_THROW( "Rename from ${srcfile} to ${dstfile} failed because ${reason}",
|
||||||
|
("srcfile",f)("dstfile",t)("reason",e.what() ) );
|
||||||
|
}
|
||||||
} catch ( ... ) {
|
} catch ( ... ) {
|
||||||
FC_THROW( "Rename from ${srcfile} to ${dstfile} failed",
|
FC_THROW( "Rename from ${srcfile} to ${dstfile} failed",
|
||||||
("srcfile",f)("dstfile",t)("inner", fc::except_str() ) );
|
("srcfile",f)("dstfile",t)("inner", fc::except_str() ) );
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue