Fix the previous commit.

FileSystem::create is never called if createWithLabel is available.
This commit is contained in:
Andrius Štikonas 2017-11-12 14:45:49 +00:00
parent 58f2decdf8
commit fad8a3568e
1 changed files with 7 additions and 8 deletions

View File

@ -121,18 +121,17 @@ bool f2fs::check(Report& report, const QString& deviceNode) const
bool f2fs::create(Report& report, const QString& deviceNode) bool f2fs::create(Report& report, const QString& deviceNode)
{ {
QStringList args; return createWithLabel(report, deviceNode, QString());
if (oldVersion)
args << deviceNode;
else
args << QStringLiteral("-f") << deviceNode;
ExternalCommand cmd(report, QStringLiteral("mkfs.f2fs"), { deviceNode });
return cmd.run(-1) && cmd.exitCode() == 0;
} }
bool f2fs::createWithLabel(Report& report, const QString& deviceNode, const QString& label) bool f2fs::createWithLabel(Report& report, const QString& deviceNode, const QString& label)
{ {
ExternalCommand cmd(report, QStringLiteral("mkfs.f2fs"), { QStringLiteral("-l"), label, deviceNode }); QStringList args;
if (oldVersion)
args << QStringLiteral("-l") << label << deviceNode;
else
args << QStringLiteral("-f") << QStringLiteral("-l") << label << deviceNode;
ExternalCommand cmd(report, QStringLiteral("mkfs.f2fs"), args);
return cmd.run(-1) && cmd.exitCode() == 0; return cmd.run(-1) && cmd.exitCode() == 0;
} }