diff --git a/include/FS_Info.h b/include/FS_Info.h index d1ecf720..f9fa32f3 100644 --- a/include/FS_Info.h +++ b/include/FS_Info.h @@ -39,6 +39,7 @@ class FS_Info { public: static void load_cache(); + static void load_cache_for_paths( const std::vector &device_paths ); static Glib::ustring get_fs_type( const Glib::ustring & path ); static Glib::ustring get_label( const Glib::ustring & path, bool & found ); static Glib::ustring get_uuid( const Glib::ustring & path ); diff --git a/src/FS_Info.cc b/src/FS_Info.cc index bdcbc7cf..4c50a1f3 100644 --- a/src/FS_Info.cc +++ b/src/FS_Info.cc @@ -54,6 +54,21 @@ void FS_Info::load_cache() fs_info_cache_initialized = true; } +void FS_Info::load_cache_for_paths( const std::vector &device_paths ) +{ + initialize_if_required(); + const BlockSpecial empty_bs = BlockSpecial(); + for ( unsigned int i = 0 ; i < device_paths.size() ; i ++ ) + { + const FS_Entry & fs_entry = get_cache_entry_by_path( device_paths[i] ); + if ( fs_entry.path == empty_bs ) + { + // Run "blkid PATH" and load entry into cache for missing entries. + load_fs_info_cache_extra_for_path( device_paths[i] ); + } + } +} + // Retrieve the file system type for the path Glib::ustring FS_Info::get_fs_type( const Glib::ustring & path ) { diff --git a/src/GParted_Core.cc b/src/GParted_Core.cc index 76b6c033..216d5197 100644 --- a/src/GParted_Core.cc +++ b/src/GParted_Core.cc @@ -257,6 +257,11 @@ void GParted_Core::set_devices_thread( std::vector * pdevices ) } } + // Ensure all named paths have FS_Info blkid cache entries specifically so that + // command line named file system image files, which blkid can't otherwise know + // about, can be identified. + FS_Info::load_cache_for_paths( device_paths ); + for ( unsigned int t = 0 ; t < device_paths .size() ; t++ ) { /*TO TRANSLATORS: looks like Searching /dev/sda partitions */