diff --git a/include/Utils.h b/include/Utils.h index 0948d44a..a26e17d4 100644 --- a/include/Utils.h +++ b/include/Utils.h @@ -175,6 +175,7 @@ public: static Glib::RefPtr get_color_as_pixbuf( FILESYSTEM filesystem, int width, int height ) ; static int get_filesystem_label_maxlength( FILESYSTEM filesystem ) ; static Glib::ustring get_filesystem_string( FILESYSTEM filesystem ) ; + static const Glib::ustring get_filesystem_kernel_name( FILESYSTEM fstype ); static Glib::ustring get_filesystem_software( FILESYSTEM filesystem ) ; static bool kernel_supports_fs( const Glib::ustring & fs ) ; static bool kernel_version_at_least( int major_ver, int minor_ver, int patch_ver ) ; diff --git a/src/Utils.cc b/src/Utils.cc index b2afdb41..f190688a 100644 --- a/src/Utils.cc +++ b/src/Utils.cc @@ -182,6 +182,7 @@ int Utils::get_filesystem_label_maxlength( FILESYSTEM filesystem ) } } +// Return libparted file system name / GParted display name Glib::ustring Utils::get_filesystem_string( FILESYSTEM filesystem ) { switch( filesystem ) @@ -244,6 +245,33 @@ Glib::ustring Utils::get_filesystem_string( FILESYSTEM filesystem ) } } +// Return Linux kernel name only for mountable file systems. +// (Identical to a subset of the libparted names except that it's hfsplus instead of hfs+). +const Glib::ustring Utils::get_filesystem_kernel_name( FILESYSTEM fstype ) +{ + switch ( fstype ) + { + case FS_BTRFS : return "btrfs"; + case FS_EXFAT : return "exfat"; + case FS_EXT2 : return "ext2"; + case FS_EXT3 : return "ext3"; + case FS_EXT4 : return "ext4"; + case FS_F2FS : return "f2fs"; + case FS_FAT16 : return "fat16"; + case FS_FAT32 : return "fat32"; + case FS_HFS : return "hfs"; + case FS_HFSPLUS : return "hfsplus"; + case FS_JFS : return "jfs"; + case FS_NILFS2 : return "nilfs2"; + case FS_NTFS : return "ntfs"; + case FS_REISER4 : return "reiser4"; + case FS_REISERFS : return "reiserfs"; + case FS_UFS : return "ufs"; + case FS_XFS : return "xfs"; + default : return ""; + } +} + Glib::ustring Utils::get_filesystem_software( FILESYSTEM filesystem ) { switch( filesystem ) diff --git a/src/Win_GParted.cc b/src/Win_GParted.cc index cc77ba17..02e6e328 100644 --- a/src/Win_GParted.cc +++ b/src/Win_GParted.cc @@ -2290,6 +2290,8 @@ void Win_GParted::activate_mount_partition( unsigned int index ) selected_partition .get_mountpoints()[ index ] ) ) ; cmd = "mount -v " + selected_partition.get_path() + " \"" + selected_partition.get_mountpoints()[index] + "\""; + // FIXME: Replace debugging with mount specifying file system type + std::cout << "DEBUG: (" << Utils::get_filesystem_kernel_name( selected_partition.filesystem ) << ") # " << cmd << std::endl; success = ! Utils::execute_command( cmd, output, error ); hide_pulsebar(); if ( ! success )