Restore functionality of FileSystem::findExternal
This also fixes unused variable warnings
This commit is contained in:
parent
a83cb256cb
commit
7ed6657e30
|
@ -69,6 +69,7 @@ QString CoreBackend::version() {
|
||||||
void CoreBackend::setId(const QString& id) {
|
void CoreBackend::setId(const QString& id) {
|
||||||
d->m_id = id;
|
d->m_id = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CoreBackend::setVersion(const QString& version) {
|
void CoreBackend::setVersion(const QString& version) {
|
||||||
d->m_version = version;
|
d->m_version = version;
|
||||||
}
|
}
|
||||||
|
|
|
@ -531,14 +531,17 @@ bool FileSystem::unmount(Report& report, const QString& deviceNode)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// FIXME: args and expectedCode is now unused.
|
|
||||||
bool FileSystem::findExternal(const QString& cmdName, const QStringList& args, int expectedCode)
|
bool FileSystem::findExternal(const QString& cmdName, const QStringList& args, int expectedCode)
|
||||||
{
|
{
|
||||||
QString cmd = QStandardPaths::findExecutable(cmdName);
|
QString cmdFullPath = QStandardPaths::findExecutable(cmdName);
|
||||||
if (cmd.isEmpty())
|
if (cmdFullPath.isEmpty())
|
||||||
cmd = QStandardPaths::findExecutable(cmdName, { QStringLiteral("/sbin/"), QStringLiteral("/usr/sbin/"), QStringLiteral("/usr/local/sbin/") });
|
cmdFullPath = QStandardPaths::findExecutable(cmdName, { QStringLiteral("/sbin/"), QStringLiteral("/usr/sbin/"), QStringLiteral("/usr/local/sbin/") });
|
||||||
|
|
||||||
return !cmd.isEmpty();
|
ExternalCommand cmd(cmdFullPath, args);
|
||||||
|
if (!cmd.run())
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return cmd.exitCode() == 0 || cmd.exitCode() == expectedCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool FileSystem::supportToolFound() const
|
bool FileSystem::supportToolFound() const
|
||||||
|
|
|
@ -61,6 +61,7 @@ protected:
|
||||||
Device& targetDevice() {
|
Device& targetDevice() {
|
||||||
return m_TargetDevice;
|
return m_TargetDevice;
|
||||||
}
|
}
|
||||||
|
|
||||||
const Device& targetDevice() const {
|
const Device& targetDevice() const {
|
||||||
return m_TargetDevice;
|
return m_TargetDevice;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue