added support for reading of volumelabel

* src/ntfs.cc: added support for reading of volumelabel
This commit is contained in:
Bart Hakvoort 2006-09-23 09:41:42 +00:00
parent 3eb92e736f
commit d106a71822
2 changed files with 22 additions and 0 deletions

View File

@ -1,3 +1,7 @@
2006-09-23 Bart Hakvoort <hakvoort@cvs.gnome.org>
* src/ntfs.cc: added support for reading of volumelabel
2006-09-17 Bart Hakvoort <hakvoort@cvs.gnome.org> 2006-09-17 Bart Hakvoort <hakvoort@cvs.gnome.org>
* added popupmenu to operationslist and did some (higrelated) cleanups * added popupmenu to operationslist and did some (higrelated) cleanups

View File

@ -31,6 +31,9 @@ FS ntfs::get_filesystem_support()
fs .read = GParted::FS::EXTERNAL ; fs .read = GParted::FS::EXTERNAL ;
fs .check = GParted::FS::EXTERNAL ; fs .check = GParted::FS::EXTERNAL ;
} }
if ( ! Glib::find_program_in_path( "ntfslabel" ) .empty() )
fs .get_label = FS::EXTERNAL ;
if ( ! Glib::find_program_in_path( "mkntfs" ) .empty() ) if ( ! Glib::find_program_in_path( "mkntfs" ) .empty() )
fs .create = GParted::FS::EXTERNAL ; fs .create = GParted::FS::EXTERNAL ;
@ -79,6 +82,21 @@ void ntfs::set_used_sectors( Partition & partition )
void ntfs::get_label( Partition & partition ) void ntfs::get_label( Partition & partition )
{ {
if ( ! Utils::execute_command( "ntfslabel --force " + partition .get_path(), output, error, true ) )
{
if ( output .size() > 0 && output[ output .size() -1 ] == '\n' )
partition .label = output .substr( 0, output .size() -1 ) ;
else
partition .label = output ;
}
else
{
if ( ! output .empty() )
partition .messages .push_back( output ) ;
if ( ! error .empty() )
partition .messages .push_back( error ) ;
}
} }
bool ntfs::create( const Partition & new_partition, OperationDetail & operationdetail ) bool ntfs::create( const Partition & new_partition, OperationDetail & operationdetail )