guix/gnu/packages/patches/kio-search-smbd-on-PATH.patch
Hartmut Goebel a6e532815d
gnu: kio: Search 'smbd' on $PATH.
Transfer the remaining NixOS patch for kio as of 2018-02-17.

* gnu/packages/patches/kio-search-smbd-on-PATH.patch: New file.
* gnu/local.mk (dist_patch_DATA): Add it.
* gnu/packages/kde-frameworks.scm(kio)<source>: Use it.
2019-01-04 10:10:42 +01:00

30 lines
1,011 B
Diff

Adopted from NixOS
pkgs/development/libraries/kde-frameworks/kio/samba-search-path.patch
===================================================================
--- kio-5.17.0.orig/src/core/ksambashare.cpp
+++ kio-5.17.0/src/core/ksambashare.cpp
@@ -67,13 +67,18 @@ KSambaSharePrivate::~KSambaSharePrivate(
bool KSambaSharePrivate::isSambaInstalled()
{
- if (QFile::exists(QStringLiteral("/usr/sbin/smbd"))
- || QFile::exists(QStringLiteral("/usr/local/sbin/smbd"))) {
- return true;
+ const QByteArray pathEnv = qgetenv("PATH");
+ if (!pathEnv.isEmpty()) {
+ QLatin1Char pathSep(':');
+ QStringList paths = QFile::decodeName(pathEnv).split(pathSep, QString::SkipEmptyParts);
+ for (QStringList::iterator it = paths.begin(); it != paths.end(); ++it) {
+ it->append("/smbd");
+ if (QFile::exists(*it)) {
+ return true;
+ }
+ }
}
- //qDebug() << "Samba is not installed!";
-
return false;
}