srctree

Robin Linden parent a5f8872f e58744a6
os/xdg: Clarify why $HOME/.local/share/fonts isn't unconditionally added

inlinesplit
os/xdg_linux.cpp added: 8, removed: 5, total 3
@@ -15,14 +15,17 @@ namespace os {
 
std::vector<std::string> font_paths() {
std::vector<std::string> paths{};
 
char const *home = std::getenv("HOME");
if (char const *xdg_data_home = std::getenv("XDG_DATA_HOME")) {
paths.push_back(xdg_data_home + "/fonts"s);
} else if (home != nullptr) {
// $HOME/.local/share/ is the default XDG_DATA_HOME, so we only add this
// path if XDG_DATA_HOME is not set.
paths.push_back(home + "/.local/share/fonts"s);
}
 
if (char const *home = std::getenv("HOME")) {
if (paths.empty()) {
paths.push_back(home + "/.local/share/fonts"s);
}
if (home != nullptr) {
paths.push_back(home + "/.fonts"s);
}