Skip to content

Commit

Permalink
XDG compliance
Browse files Browse the repository at this point in the history
  • Loading branch information
jpcima committed May 7, 2021
1 parent 67ccd2f commit ae62725
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions sources/plugin/Config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,19 @@ const std::string &get_configuration_dir()
path.append(DISTRHO_PLUGIN_NAME "/");
mkdir(path.c_str(), 0755);
#else
path = get_home_directory();
if (path.empty())
return std::string();
path.append(".config/");
if (const char *env = std::getenv("XDG_CONFIG_HOME")) {
if (env[0] == '/') {
path = env;
if (path.back() != '/')
path.push_back('/');
}
}
if (path.empty()) {
path = get_home_directory();
if (path.empty())
return std::string();
path.append(".config/");
}
mkdir(path.c_str(), 0755);
path.append(DISTRHO_PLUGIN_NAME "/");
mkdir(path.c_str(), 0755);
Expand Down

0 comments on commit ae62725

Please sign in to comment.