gparted r872 - in trunk: . src
- From: gedakc svn gnome org
- To: svn-commits-list gnome org
- Subject: gparted r872 - in trunk: . src
- Date: Fri, 25 Jul 2008 23:05:20 +0000 (UTC)
Author: gedakc
Date: Fri Jul 25 23:05:20 2008
New Revision: 872
URL: http://svn.gnome.org/viewvc/gparted?rev=872&view=rev
Log:
Rewrote get_label to use vol_id command for hfs file system
Modified:
trunk/AUTHORS
trunk/ChangeLog
trunk/README
trunk/src/hfs.cc
Modified: trunk/AUTHORS
==============================================================================
--- trunk/AUTHORS (original)
+++ trunk/AUTHORS Fri Jul 25 23:05:20 2008
@@ -12,6 +12,7 @@
We need to keep track of copyright (see the Maintainer HOWTO on www.gnu.org).
Curtis Gedak <gedakc users sourceforge net>
+ * Rewrote get_label functionality for hfs
* Wrote create, get_label, and check_repair functionality for hfs+
* Wrote get_label functionality for fat16 and fat32 filesystems
* Wrote Utils::regexp_label() function
Modified: trunk/README
==============================================================================
--- trunk/README (original)
+++ trunk/README Fri Jul 25 23:05:20 2008
@@ -98,10 +98,11 @@
dosfstools
mtools
hfsutils
+ hfsprogs
jfsutils
ntfsprogs
reiser4progs
reiserfsprogs
xfsprogs
NOTE: If the vol_id command is in the search PATH, it will be
- used to read linux-swap volume labels.
+ used to read linux-swap, hfs, and hfs+ file system volume labels.
Modified: trunk/src/hfs.cc
==============================================================================
--- trunk/src/hfs.cc (original)
+++ trunk/src/hfs.cc Fri Jul 25 23:05:20 2008
@@ -32,12 +32,12 @@
if ( ! Glib::find_program_in_path( "hformat" ) .empty() )
fs .create = GParted::FS::EXTERNAL ;
-
+
if ( ! Glib::find_program_in_path( "hfsck" ) .empty() )
- {
- fs .get_label = FS::EXTERNAL ;
fs .check = FS::EXTERNAL ;
- }
+
+ if ( ! Glib::find_program_in_path( "vol_id" ) .empty() )
+ fs .get_label = FS::EXTERNAL ;
fs .copy = GParted::FS::GPARTED ;
fs .move = GParted::FS::GPARTED ;
@@ -53,22 +53,12 @@
void hfs::get_label( Partition & partition )
{
- if ( ! Utils::execute_command( "hfsck -v " + partition .get_path(), output, error, true ) )
+ if ( ! Utils::execute_command( "vol_id " + partition .get_path(), output, error, true ) )
{
- char buf[512] ;
- index = output .find( "drVN" ) ;
-
- if ( index < output .length() && sscanf( output .substr( index ) .c_str(), "drVN = %512s", buf ) == 1 )
- {
- partition .label = buf ;
-
- //remove "" from the label..
- if ( partition .label .size() > 0 && partition .label[0] == '\"' )
- partition .label = partition .label .substr( 1 ) ;
-
- if ( partition .label .size() > 0 && partition .label[ partition .label .size() -1 ] == '\"' )
- partition .label = partition .label .substr( 0, partition .label .size() -1 ) ;
- }
+ Glib::ustring label = Utils::regexp_label( output, "ID_FS_LABEL=([^\n]*)" ) ;
+ //FIXME: find a better way to see if label is empty.. imagine someone uses 'untitled' as label.... ;)
+ if( label != "untitled" )
+ partition .label = label ;
}
else
{
@@ -114,5 +104,3 @@
}
} //GParted
-
-
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]