kio: look through entire PATH for samba
This commit is contained in:
parent
b9928cbd0d
commit
fdbf2e5527
|
@ -1,28 +1,14 @@
|
||||||
Index: kio-5.17.0/src/core/ksambashare.cpp
|
diff --git a/src/core/ksambashare.cpp b/src/core/ksambashare.cpp
|
||||||
===================================================================
|
index 1895783..9fe7286 100644
|
||||||
--- kio-5.17.0.orig/src/core/ksambashare.cpp
|
--- a/src/core/ksambashare.cpp
|
||||||
+++ kio-5.17.0/src/core/ksambashare.cpp
|
+++ b/src/core/ksambashare.cpp
|
||||||
@@ -67,13 +67,18 @@ KSambaSharePrivate::~KSambaSharePrivate(
|
@@ -73,8 +73,7 @@ KSambaSharePrivate::~KSambaSharePrivate()
|
||||||
|
|
||||||
bool KSambaSharePrivate::isSambaInstalled()
|
bool KSambaSharePrivate::isSambaInstalled()
|
||||||
{
|
{
|
||||||
- if (QFile::exists(QStringLiteral("/usr/sbin/smbd"))
|
const bool daemonExists =
|
||||||
- || QFile::exists(QStringLiteral("/usr/local/sbin/smbd"))) {
|
- !QStandardPaths::findExecutable(QStringLiteral("smbd"),
|
||||||
- return true;
|
- {QStringLiteral("/usr/sbin/"), QStringLiteral("/usr/local/sbin/")}).isEmpty();
|
||||||
+ const QByteArray pathEnv = qgetenv("PATH");
|
+ !QStandardPaths::findExecutable(QStringLiteral("smbd")).isEmpty();
|
||||||
+ if (!pathEnv.isEmpty()) {
|
if (!daemonExists) {
|
||||||
+ QLatin1Char pathSep(':');
|
qCDebug(KIO_CORE_SAMBASHARE) << "KSambaShare: Could not find smbd";
|
||||||
+ QStringList paths = QFile::decodeName(pathEnv).split(pathSep, QString::SkipEmptyParts);
|
|
||||||
+ for (QStringList::iterator it = paths.begin(); it != paths.end(); ++it) {
|
|
||||||
+ it->append(QStringLiteral("/smbd"));
|
|
||||||
+ if (QFile::exists(*it)) {
|
|
||||||
+ return true;
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
- //qDebug() << "Samba is not installed!";
|
|
||||||
-
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue