This commit is contained in:
Aurélien Gâteau 2014-07-10 15:14:06 +02:00
parent e792f4c9c5
commit 8d01b9a6fd

View File

@ -51,19 +51,32 @@ Calamares::JobResult
CreatePartitionJob::exec() CreatePartitionJob::exec()
{ {
Report report( 0 ); Report report( 0 );
QString message = tr( "The installer failed to create partition on %1." ).arg( m_device->name() );
CoreBackend* backend = CoreBackendManager::self()->backend(); CoreBackend* backend = CoreBackendManager::self()->backend();
QScopedPointer<CoreBackendDevice> backendDevice( backend->openDevice( m_device->deviceNode() ) ); QScopedPointer<CoreBackendDevice> backendDevice( backend->openDevice( m_device->deviceNode() ) );
Q_ASSERT( backendDevice.data() ); if ( !backendDevice.data() )
{
return Calamares::JobResult::error(
message,
tr( "Could not open device %1." ).arg( m_device->deviceNode() )
);
}
QScopedPointer<CoreBackendPartitionTable> backendPartitionTable( backendDevice->openPartitionTable() ); QScopedPointer<CoreBackendPartitionTable> backendPartitionTable( backendDevice->openPartitionTable() );
Q_ASSERT( backendPartitionTable ); if ( !backendPartitionTable.data() )
{
return Calamares::JobResult::error(
message,
tr( "Could not open partition table." )
);
}
QString partitionPath = backendPartitionTable->createPartition( report, *m_partition ); QString partitionPath = backendPartitionTable->createPartition( report, *m_partition );
if ( partitionPath.isEmpty() ) if ( partitionPath.isEmpty() )
{ {
return Calamares::JobResult::error( return Calamares::JobResult::error(
tr( "The installer failed to create partition on %1." ).arg( m_device->name() ), message,
report.toText() report.toText()
); );
} }