[gparted] Enhance to work with mount points defined by uuid or label



commit b176a96e2844ed6fe936175755de573a7242fccf
Author: Curtis Gedak <gedakc gmail com>
Date:   Thu Dec 9 14:58:03 2010 -0700

    Enhance to work with mount points defined by uuid or label

 src/GParted_Core.cc |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)
---
diff --git a/src/GParted_Core.cc b/src/GParted_Core.cc
index b928774..baf1442 100644
--- a/src/GParted_Core.cc
+++ b/src/GParted_Core.cc
@@ -749,6 +749,8 @@ void GParted_Core::read_mountpoints_from_file(
 	const Glib::ustring & filename,
 	std::map< Glib::ustring, std::vector<Glib::ustring> > & map )
 {
+	FS_Info fs_info ;  //Use cache of file system information
+
 	FILE* fp = setmntent( filename .c_str(), "r" ) ;
 
 	if ( fp == NULL )
@@ -760,6 +762,14 @@ void GParted_Core::read_mountpoints_from_file(
 	{
 		Glib::ustring node = p->mnt_fsname ;
 
+		Glib::ustring uuid = Utils::regexp_label( node, "^UUID=(.*)" ) ;
+		if ( ! uuid .empty() )
+			node = fs_info .get_path_by_uuid( uuid ) ;
+
+		Glib::ustring label = Utils::regexp_label( node, "^LABEL=(.*)" ) ;
+		if ( ! label .empty() )
+			node = fs_info .get_path_by_label( label ) ;
+
 		if ( ! node .empty() )
 		{
 			Glib::ustring mountpoint = p->mnt_dir ;



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]