[libcalamares] Add convenience backend() to KPMManager

This commit is contained in:
Adriaan de Groot 2019-06-13 23:16:05 +02:00
parent d039f9bbb8
commit d0d017f5fe
3 changed files with 11 additions and 3 deletions

View File

@ -115,6 +115,12 @@ KPMManager::operator bool() const
return s_kpm_loaded; return s_kpm_loaded;
} }
CoreBackend*
KPMManager::backend() const
{
return s_kpm_loaded ? CoreBackendManager::self()->backend() : nullptr;
}
} // namespace Partition } // namespace Partition
} // namespace CalamaresUtils } // namespace CalamaresUtils

View File

@ -50,6 +50,10 @@ public:
/// @brief Is KPMCore loaded correctly? /// @brief Is KPMCore loaded correctly?
operator bool() const; operator bool() const;
/// @brief Gets the KPMCore backend (e.g. CoreBackendManager::self()->backend() )
CoreBackend* backend() const;
private: private:
std::shared_ptr< InternalManager > m_d; std::shared_ptr< InternalManager > m_d;
}; };

View File

@ -31,7 +31,6 @@
// CalaPM // CalaPM
#include <backend/corebackend.h> #include <backend/corebackend.h>
#include <backend/corebackendmanager.h>
#include <fs/filesystemfactory.h> #include <fs/filesystemfactory.h>
// Qt // Qt
@ -198,8 +197,7 @@ void
PartitionJobTests::refreshDevice() PartitionJobTests::refreshDevice()
{ {
QString devicePath = qgetenv( "CALAMARES_TEST_DISK" ); QString devicePath = qgetenv( "CALAMARES_TEST_DISK" );
CoreBackend* backend = CoreBackendManager::self()->backend(); m_device.reset( kpmcore->backend()->scanDevice( devicePath ) );
m_device.reset( backend->scanDevice( devicePath ) );
QVERIFY( !m_device.isNull() ); QVERIFY( !m_device.isNull() );
} }