From 9d956594d6acf0d983ae9105df2f3772194a5404 Mon Sep 17 00:00:00 2001 From: Bart Hakvoort Date: Sun, 27 Aug 2006 12:05:05 +0000 Subject: [PATCH] replaced ntfscluster with ntfsresize (see #350789) * src/ntfs.cc: replaced ntfscluster with ntfsresize (see #350789) --- ChangeLog | 4 ++++ src/ntfs.cc | 25 +++++++++++++------------ 2 files changed, 17 insertions(+), 12 deletions(-) diff --git a/ChangeLog b/ChangeLog index 14bcdabc..ae2c142d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2006-08-27 Bart Hakvoort + + * src/ntfs.cc: replaced ntfscluster with ntfsresize (see #350789) + 2006-08-27 Bart Hakvoort * happy 24th birthday Johannes! :^) diff --git a/src/ntfs.cc b/src/ntfs.cc index 7a5e429d..662e7423 100644 --- a/src/ntfs.cc +++ b/src/ntfs.cc @@ -25,18 +25,18 @@ FS ntfs::get_filesystem_support() { FS fs ; fs .filesystem = GParted::FS_NTFS ; - - if ( ! Glib::find_program_in_path( "ntfscluster" ) .empty() ) + + if ( ! Glib::find_program_in_path( "ntfsresize" ) .empty() ) + { fs .read = GParted::FS::EXTERNAL ; + fs .check = GParted::FS::EXTERNAL ; + } if ( ! Glib::find_program_in_path( "mkntfs" ) .empty() ) fs .create = GParted::FS::EXTERNAL ; - - if ( ! Glib::find_program_in_path( "ntfsfix" ) .empty() ) - fs .check = GParted::FS::EXTERNAL ; - + //resizing is a delicate process ... - if ( ! Glib::find_program_in_path( "ntfsresize" ) .empty() && fs .check ) + if ( fs .read && fs .check ) { fs .grow = GParted::FS::EXTERNAL ; @@ -56,15 +56,16 @@ FS ntfs::get_filesystem_support() void ntfs::set_used_sectors( Partition & partition ) { - if ( ! Utils::execute_command( "ntfscluster --force " + partition .get_path(), output, error, true ) ) + if ( ! Utils::execute_command( + "ntfsresize --info --force --no-progress-bar " + partition .get_path(), output, error, true ) ) { - index = output .find( "sectors of free space" ) ; - if ( index >= output .length() || - sscanf( output .substr( index ) .c_str(), "sectors of free space : %Ld", &N ) != 1 ) + index = output .find( "resize at" ) ; + if ( index >= output .length() || + sscanf( output .substr( index ) .c_str(), "resize at %Ld", &N ) != 1 ) N = -1 ; if ( N > -1 ) - partition .Set_Unused( N ) ; + partition .set_used( Utils::round( N / 512.0 ) ) ; } else partition .messages .push_back( error ) ;