kemu: attempt to modprobe only on Linux

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
Ivailo Monev 2021-08-08 17:53:59 +03:00
parent 51401039ae
commit f02ee100af

View file

@ -115,17 +115,19 @@ KEmuMainWindow::KEmuMainWindow(QWidget *parent, Qt::WindowFlags flags)
QFileInfo kvmDev("/dev/kvm");
if (!kvmDev.exists()) {
#ifdef Q_OS_LINUX
const QString modprobeBin = KStandardDirs::findRootExe("modprobe");
if (!modprobeBin.isEmpty()) {
QProcess modprobe(this);
modprobe.start(modprobeBin, QStringList() << "-b" << "kvm");
modprobe.waitForFinished();
if (!kvmDev.exists()) {
QMessageBox::warning(this, i18n("KVM not available"), i18n("KVM not available"));
}
} else {
kDebug() << "modprobe not found";
}
#endif
if (!kvmDev.exists()) {
QMessageBox::warning(this, i18n("KVM not available"), i18n("KVM not available"));
}
}
connect(m_kemuui->CDROMInput, SIGNAL(textChanged(QString)), this, SLOT(machineSave(QString)));