Use trimmed() instead of simplified().
This commit is contained in:
parent
27af037bb4
commit
0bd44b94dc
|
@ -66,7 +66,7 @@ static qint32 getPhysicalSectorSize(const QString& device_node)
|
|||
|
||||
if (f.open(QIODevice::ReadOnly)) {
|
||||
QByteArray a = f.readLine();
|
||||
return a.simplified().toInt();
|
||||
return a.trimmed().toInt();
|
||||
}
|
||||
|
||||
return -1;
|
||||
|
|
|
@ -510,7 +510,7 @@ QString luks::readUUID(const QString& deviceNode) const
|
|||
ExternalCommand cmd(QStringLiteral("cryptsetup"),
|
||||
{ QStringLiteral("luksUUID"), deviceNode });
|
||||
if (cmd.run()) {
|
||||
return cmd.output().simplified();
|
||||
return cmd.output().trimmed();
|
||||
}
|
||||
return QStringLiteral("---");
|
||||
}
|
||||
|
|
|
@ -123,19 +123,13 @@ qint64 ntfs::readUsedCapacity(const QString& deviceNode) const
|
|||
|
||||
bool ntfs::writeLabel(Report& report, const QString& deviceNode, const QString& newLabel)
|
||||
{
|
||||
ExternalCommand writeCmd(report, QStringLiteral("ntfslabel"), { QStringLiteral("--force"), deviceNode, newLabel.simplified() });
|
||||
ExternalCommand writeCmd(report, QStringLiteral("ntfslabel"), { QStringLiteral("--force"), deviceNode, newLabel });
|
||||
writeCmd.setProcessChannelMode(QProcess::SeparateChannels);
|
||||
|
||||
if (!writeCmd.run(-1))
|
||||
return false;
|
||||
|
||||
ExternalCommand testCmd(QStringLiteral("ntfslabel"), { QStringLiteral("--force"), deviceNode });
|
||||
testCmd.setProcessChannelMode(QProcess::SeparateChannels);
|
||||
|
||||
if (!testCmd.run(-1))
|
||||
return false;
|
||||
|
||||
return testCmd.output().simplified() == newLabel.simplified();
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ntfs::check(Report& report, const QString& deviceNode) const
|
||||
|
|
|
@ -79,7 +79,7 @@ bool isMounted(const QString& deviceNode)
|
|||
deviceNode });
|
||||
|
||||
if (cmd.run(-1) && cmd.exitCode() == 0) {
|
||||
return !cmd.output().simplified().isEmpty();
|
||||
return !cmd.output().trimmed().isEmpty();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue