diff --git a/include/FS_Info.h b/include/FS_Info.h index 5421ab87..e0a40c19 100644 --- a/include/FS_Info.h +++ b/include/FS_Info.h @@ -38,6 +38,7 @@ struct FS_Entry class FS_Info { public: + static void clear_cache(); static void load_cache_for_paths(const std::vector& paths); static Glib::ustring get_fs_type( const Glib::ustring & path ); static Glib::ustring get_label( const Glib::ustring & path, bool & found ); diff --git a/src/FS_Info.cc b/src/FS_Info.cc index c095db13..4bd22165 100644 --- a/src/FS_Info.cc +++ b/src/FS_Info.cc @@ -51,15 +51,23 @@ bool FS_Info::need_blkid_vfat_cache_update_workaround = true; std::vector FS_Info::fs_info_cache; -void FS_Info::load_cache_for_paths(const std::vector& paths) +void FS_Info::clear_cache() { set_commands_found(); fs_info_cache.clear(); - run_blkid_load_cache(paths); fs_info_cache_initialized = true; } +void FS_Info::load_cache_for_paths(const std::vector& paths) +{ + if (not_initialised_then_error()) + return; + + run_blkid_load_cache(paths); +} + + // 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 7841868d..afbd116a 100644 --- a/src/GParted_Core.cc +++ b/src/GParted_Core.cc @@ -248,6 +248,7 @@ void GParted_Core::set_devices_thread( std::vector * pdevices ) } // Initialise and load caches needed for content discovery. + FS_Info::clear_cache(); const std::vector& device_and_partition_paths = Proc_Partitions_Info::get_device_and_partition_paths_for(device_paths); FS_Info::load_cache_for_paths(device_and_partition_paths);