From d106a71822717f6d72c51c7039fee022d2c3423d Mon Sep 17 00:00:00 2001 From: Bart Hakvoort Date: Sat, 23 Sep 2006 09:41:42 +0000 Subject: [PATCH] added support for reading of volumelabel * src/ntfs.cc: added support for reading of volumelabel --- ChangeLog | 4 ++++ src/ntfs.cc | 18 ++++++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/ChangeLog b/ChangeLog index f7102a5d..92fb3567 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2006-09-23 Bart Hakvoort + + * src/ntfs.cc: added support for reading of volumelabel + 2006-09-17 Bart Hakvoort * added popupmenu to operationslist and did some (higrelated) cleanups diff --git a/src/ntfs.cc b/src/ntfs.cc index f6bd11a8..e8035271 100644 --- a/src/ntfs.cc +++ b/src/ntfs.cc @@ -31,6 +31,9 @@ FS ntfs::get_filesystem_support() fs .read = 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() ) fs .create = GParted::FS::EXTERNAL ; @@ -79,6 +82,21 @@ void ntfs::set_used_sectors( 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 )