[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: [kpmcore/kauth] src: Restore functionality of FileSystem::findExternal
From: Andrius_Å tikonas <null () kde ! org>
Date: 2018-03-31 22:50:12
Message-ID: E1f2PK8-0001Nv-4Z () code ! kde ! org
[Download RAW message or body]
Git commit 7ed6657e30a742e2aad8a6e49cbd8aa3d8bbcc42 by Andrius Å tikonas.
Committed on 31/03/2018 at 22:49.
Pushed by stikonas into branch 'kauth'.
Restore functionality of FileSystem::findExternal
This also fixes unused variable warnings
M +1 -0 src/backend/corebackend.cpp
M +8 -5 src/fs/filesystem.cpp
M +1 -0 src/ops/backupoperation.h
https://commits.kde.org/kpmcore/7ed6657e30a742e2aad8a6e49cbd8aa3d8bbcc42
diff --git a/src/backend/corebackend.cpp b/src/backend/corebackend.cpp
index 380ffe1..5360610 100644
--- a/src/backend/corebackend.cpp
+++ b/src/backend/corebackend.cpp
@@ -69,6 +69,7 @@ QString CoreBackend::version() {
void CoreBackend::setId(const QString& id) {
d->m_id = id;
}
+
void CoreBackend::setVersion(const QString& version) {
d->m_version = version;
}
diff --git a/src/fs/filesystem.cpp b/src/fs/filesystem.cpp
index b0e9f04..f540145 100644
--- a/src/fs/filesystem.cpp
+++ b/src/fs/filesystem.cpp
@@ -531,14 +531,17 @@ bool FileSystem::unmount(Report& report, const QString& \
deviceNode) return false;
}
-// FIXME: args and expectedCode is now unused.
bool FileSystem::findExternal(const QString& cmdName, const QStringList& args, int \
expectedCode) {
- QString cmd = QStandardPaths::findExecutable(cmdName);
- if (cmd.isEmpty())
- cmd = QStandardPaths::findExecutable(cmdName, { QStringLiteral("/sbin/"), \
QStringLiteral("/usr/sbin/"), QStringLiteral("/usr/local/sbin/") }); + QString \
cmdFullPath = QStandardPaths::findExecutable(cmdName); + if \
(cmdFullPath.isEmpty()) + 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
diff --git a/src/ops/backupoperation.h b/src/ops/backupoperation.h
index 9f3002d..21fd3f8 100644
--- a/src/ops/backupoperation.h
+++ b/src/ops/backupoperation.h
@@ -61,6 +61,7 @@ protected:
Device& targetDevice() {
return m_TargetDevice;
}
+
const Device& targetDevice() const {
return m_TargetDevice;
}
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic