aboutsummaryrefslogtreecommitdiff
path: root/src/browser.cpp
diff options
context:
space:
mode:
authorAqua-sama <aqua@iserlohn-fortress.net>2017-03-19 14:33:07 +0100
committerAqua-sama <aqua@iserlohn-fortress.net>2017-03-19 14:33:07 +0100
commit5b72a6b5787a360e36d137fe2d52f47be926a588 (patch)
tree935a36f13e6287ca5492a1e172e1cf287eccb501 /src/browser.cpp
parentBlocker rewrites (diff)
downloadsmolbote-5b72a6b5787a360e36d137fe2d52f47be926a588.tar.xz
Added build script
Additional locations are searched for configuration
Diffstat (limited to 'src/browser.cpp')
-rw-r--r--src/browser.cpp28
1 files changed, 23 insertions, 5 deletions
diff --git a/src/browser.cpp b/src/browser.cpp
index 4697ac5..41c6355 100644
--- a/src/browser.cpp
+++ b/src/browser.cpp
@@ -125,12 +125,30 @@ DownloadDialog *Browser::downloads()
void Browser::setConfigPath(const QString &path)
{
- if(path.isEmpty()) {
- // set default config path
- m_settings = new Settings(QStandardPaths::writableLocation(QStandardPaths::AppConfigLocation) + "/poi.conf");
- } else {
- // set custom config path
+ // set custom config path if any
+ if(!path.isEmpty()) {
m_settings = new Settings(path);
+ return;
+ }
+
+ // check if config file exists for this user
+ QString cpath = QStandardPaths::writableLocation(QStandardPaths::AppConfigLocation) + "/poi.conf";
+ if(QFile::exists(cpath)) {
+ m_settings = new Settings(cpath);
+ }
+
+ // check system-specific locations
+#ifdef Q_OS_LINUX
+ else if(QFile::exists("/usr/share/smolbote/poi.conf")) {
+ m_settings = new Settings("/usr/share/smolbote/poi.conf");
+ }
+ else if(QFile::exists("/usr/local/share/smolbote/poi.conf")) {
+ m_settings = new Settings("/usr/local/share/smolbote/poi.conf");
+ }
+#endif
+
+ else {
+ m_settings = new Settings();
}
}