Unverified Commit 5c2bcb17 authored by azubieta's avatar azubieta

Add /etc to the config search locations

parent 7e0807a7
Pipeline #435 passed with stages
in 6 minutes and 55 seconds
......@@ -9,8 +9,7 @@
// local
#include "Settings.h"
Settings::Settings() {
}
Settings::Settings() = default;
QStringList Settings::getOCSProviders() {
YAML::Node node = loadProvidersConfigFile();
......@@ -20,7 +19,7 @@ QStringList Settings::getOCSProviders() {
return QStringList();
}
void Settings::setOCSProviders(QStringList ocsProviders) {
void Settings::setOCSProviders(const QStringList& ocsProviders) {
YAML::Node providersRoot = loadProvidersConfigFile();
setOCSProviders(providersRoot, ocsProviders);
......@@ -44,6 +43,7 @@ YAML::Node Settings::loadProvidersConfigFile() {
configLocations.append(".");
configLocations.append(QStandardPaths::standardLocations(QStandardPaths::ConfigLocation));
configLocations.append("/etc");
configLocations.append(qgetenv("APPDIR") + "/etc");
for (const QString& location: configLocations) {
QString filePath = location + "/appimage-providers.yaml";
......@@ -59,9 +59,9 @@ YAML::Node Settings::loadProvidersConfigFile() {
return YAML::Node();
}
void Settings::saveProvidersConfigFile(YAML::Node root) {
void Settings::saveProvidersConfigFile(const YAML::Node& root) {
QStringList configLocations = QStandardPaths::standardLocations(QStandardPaths::ConfigLocation);
if (configLocations.size() > 0) {
if (configLocations.empty()) {
QString filePath = configLocations.first() + "/appimage-providers.yaml";
std::ofstream fout(filePath.toStdString());
......
......@@ -10,12 +10,12 @@ public:
QStringList getOCSProviders();
void setOCSProviders(QStringList ocsProviders);
void setOCSProviders(const QStringList& ocsProviders);
private:
YAML::Node loadProvidersConfigFile();
void saveProvidersConfigFile(YAML::Node root);
void saveProvidersConfigFile(const YAML::Node& root);
QStringList getOCSProviders(YAML::Node root);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment