diff --git a/src/libcalamares/partition/KPMManager.cpp b/src/libcalamares/partition/KPMManager.cpp index 061884f10..edfc5aa4c 100644 --- a/src/libcalamares/partition/KPMManager.cpp +++ b/src/libcalamares/partition/KPMManager.cpp @@ -115,6 +115,12 @@ KPMManager::operator bool() const return s_kpm_loaded; } +CoreBackend* +KPMManager::backend() const +{ + return s_kpm_loaded ? CoreBackendManager::self()->backend() : nullptr; +} + } // namespace Partition } // namespace CalamaresUtils diff --git a/src/libcalamares/partition/KPMManager.h b/src/libcalamares/partition/KPMManager.h index de8ea787b..15df57448 100644 --- a/src/libcalamares/partition/KPMManager.h +++ b/src/libcalamares/partition/KPMManager.h @@ -50,6 +50,10 @@ public: /// @brief Is KPMCore loaded correctly? operator bool() const; + + /// @brief Gets the KPMCore backend (e.g. CoreBackendManager::self()->backend() ) + CoreBackend* backend() const; + private: std::shared_ptr< InternalManager > m_d; }; diff --git a/src/modules/partition/tests/PartitionJobTests.cpp b/src/modules/partition/tests/PartitionJobTests.cpp index ae1f37784..2f30f0d8e 100644 --- a/src/modules/partition/tests/PartitionJobTests.cpp +++ b/src/modules/partition/tests/PartitionJobTests.cpp @@ -31,7 +31,6 @@ // CalaPM #include -#include #include // Qt @@ -198,8 +197,7 @@ void PartitionJobTests::refreshDevice() { QString devicePath = qgetenv( "CALAMARES_TEST_DISK" ); - CoreBackend* backend = CoreBackendManager::self()->backend(); - m_device.reset( backend->scanDevice( devicePath ) ); + m_device.reset( kpmcore->backend()->scanDevice( devicePath ) ); QVERIFY( !m_device.isNull() ); }