Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(Linux) Extend support for the XDG Base Directory #1103

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 19 additions & 7 deletions src/global.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,16 +35,18 @@ Translator * Global::translator = 0;

using namespace Global;

void Global::global_init(const QString & config_path) {
qDebug("global_init");

// Translator
translator = new Translator();

// settings
void Global::init_settings(const QString & config_path) {
if (!config_path.isEmpty()) {
Paths::setConfigPath(config_path);
}
// fallback mechanism supports xdg directories
#if !defined(PORTABLE_APP) && defined(Q_OS_LINUX)
else {
settings = new QSettings(QSettings::IniFormat, QSettings::UserScope,
QString(PROGRAM), QString(PROGRAM) );
return;
}
#endif

if (Paths::iniPath().isEmpty()) {
settings = new QSettings(QSettings::IniFormat, QSettings::UserScope,
Expand All @@ -55,6 +57,16 @@ void Global::global_init(const QString & config_path) {
qDebug("global_init: config file: '%s'", filename.toUtf8().data());

}
}

void Global::global_init(const QString & config_path) {
qDebug("global_init");

// Translator
translator = new Translator();

// settings
init_settings(config_path);

// Preferences
pref = new Preferences();
Expand Down
1 change: 1 addition & 0 deletions src/global.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ namespace Global {
extern Translator * translator;


void init_settings(const QString & config_path);
void global_init(const QString & config_path);
void global_end();

Expand Down