adding resize_file
This commit is contained in:
parent
fa98cb6816
commit
f18e16cbc7
2 changed files with 17 additions and 0 deletions
|
|
@ -115,6 +115,7 @@ namespace fc {
|
|||
bool remove( const path& p );
|
||||
void copy( const path& from, const path& to );
|
||||
void rename( const path& from, const path& to );
|
||||
void resize_file( const path& file, size_t s );
|
||||
|
||||
void create_hard_link( const path& from, const path& to );
|
||||
|
||||
|
|
|
|||
|
|
@ -162,6 +162,22 @@ namespace fc {
|
|||
("srcfile",f)("dstfile",t)("inner", fc::except_str() ) );
|
||||
}
|
||||
}
|
||||
void resize_file( const path& f, size_t t )
|
||||
{
|
||||
try {
|
||||
boost::filesystem::resize_file( f, t );
|
||||
}
|
||||
catch ( boost::system::system_error& e )
|
||||
{
|
||||
FC_THROW( "Resize file '${f}' to size ${s} failed: ${reason}",
|
||||
("f",f)("s",t)( "reason", e.what() ) );
|
||||
}
|
||||
catch ( ... )
|
||||
{
|
||||
FC_THROW( "Resize file '${f}' to size ${s} failed: ${reason}",
|
||||
("f",f)("s",t)( "reason", fc::except_str() ) );
|
||||
}
|
||||
}
|
||||
void rename( const path& f, const path& t ) {
|
||||
try {
|
||||
boost::filesystem::rename( boost::filesystem::path(f), boost::filesystem::path(t) );
|
||||
|
|
|
|||
Loading…
Reference in a new issue