diff options
-rw-r--r-- | src/murmur/UnixMurmur.cpp | 26 | ||||
-rw-r--r-- | src/murmur/UnixMurmur.h | 1 | ||||
-rw-r--r-- | src/murmur/main.cpp | 3 |
3 files changed, 30 insertions, 0 deletions
diff --git a/src/murmur/UnixMurmur.cpp b/src/murmur/UnixMurmur.cpp index adc24f308..799f0cce8 100644 --- a/src/murmur/UnixMurmur.cpp +++ b/src/murmur/UnixMurmur.cpp @@ -320,3 +320,29 @@ void UnixMurmur::finalcap() { cap_free(c); #endif } + +const QString UnixMurmur::trySystemIniFiles(const QString& fname) { + QString file = fname; + if (!file.isEmpty()) + return file; +#if defined(Q_OS_LINUX) + if (!bRoot) + return file; + + QStringList inipaths; + + inipaths << QLatin1String("/usr/local/etc/mumble-server.ini"); + inipaths << QLatin1String("/usr/local/etc/murmur.ini"); + inipaths << QLatin1String("/etc/mumble-server.ini"); + inipaths << QLatin1String("/etc/murmur.ini"); + + foreach(const QString &f, inipaths) { + QFileInfo fi(f); + if (fi.exists() && fi.isReadable()) { + file = fi.absoluteFilePath(); + break; + } + } +#endif + return file; +} diff --git a/src/murmur/UnixMurmur.h b/src/murmur/UnixMurmur.h index efd53c3df..4616bc665 100644 --- a/src/murmur/UnixMurmur.h +++ b/src/murmur/UnixMurmur.h @@ -69,6 +69,7 @@ class UnixMurmur : public QObject { void setuid(); void initialcap(); void finalcap(); + const QString trySystemIniFiles(const QString& fname); UnixMurmur(); ~UnixMurmur(); diff --git a/src/murmur/main.cpp b/src/murmur/main.cpp index f70cc2ca1..cb38c3f14 100644 --- a/src/murmur/main.cpp +++ b/src/murmur/main.cpp @@ -282,6 +282,9 @@ int main(int argc, char **argv) { } } +#ifdef Q_OS_UNIX + inifile = unixhandler.trySystemIniFiles(inifile); +#endif Meta::mp.read(inifile); |