Make sure file system is not mounted before deleting it.

Sometimes user might try to mount manually and then delete partition
without refreshing state in KPM.
This commit is contained in:
Andrius Štikonas 2016-05-26 18:47:34 +01:00
parent 0c70c66aae
commit 8ae2ea3006
1 changed files with 7 additions and 0 deletions

View File

@ -26,6 +26,7 @@
#include "core/partition.h"
#include "core/device.h"
#include "util/helpers.h"
#include "util/report.h"
#include <QDebug>
@ -56,6 +57,12 @@ bool DeleteFileSystemJob::run(Report& parent)
Report* report = jobStarted(parent);
if (isMounted(partition().partitionPath())) {
report->line() << xi18nc("@info/plain", "Could not delete file system: file system on <filename>%1</filename> is mounted.", partition().deviceNode());
jobFinished(*report, rval);
return false;
}
if (partition().roles().has(PartitionRole::Extended))
rval = true;
else {