diff --git a/common/application.cpp b/common/application.cpp index 065c7a0f..54d863cc 100644 --- a/common/application.cpp +++ b/common/application.cpp @@ -241,7 +241,6 @@ std::unordered_map list_applications() }); } } - do_data_dir(xdg_data_home(), res); for (auto && dir: xdg_data_dirs()) do_data_dir(std::move(dir), res); diff --git a/common/utils/xdg_base_directory.cpp b/common/utils/xdg_base_directory.cpp index 5fe65d12..20d93974 100644 --- a/common/utils/xdg_base_directory.cpp +++ b/common/utils/xdg_base_directory.cpp @@ -45,7 +45,7 @@ std::filesystem::path xdg_cache_home() std::filesystem::path xdg_data_home() { - if (const char * xdg_data_home = std::getenv("XDG_DATA_HOME")) + if (const char * xdg_data_home = std::getenv("XDG_DATA_HOME"); xdg_data_home and *xdg_data_home) return xdg_data_home; if (const char * home = std::getenv("HOME")) @@ -71,9 +71,11 @@ std::vector xdg_config_dirs() return paths; } -std::vector xdg_data_dirs() +std::vector xdg_data_dirs(bool include_data_home) { std::vector paths; + if (include_data_home) + paths.push_back(xdg_data_home()); if (const char * xdg_config_dirs = std::getenv("XDG_DATA_DIRS")) { diff --git a/common/utils/xdg_base_directory.h b/common/utils/xdg_base_directory.h index ef56baae..84a2aae9 100644 --- a/common/utils/xdg_base_directory.h +++ b/common/utils/xdg_base_directory.h @@ -26,4 +26,4 @@ std::filesystem::path xdg_config_home(); std::filesystem::path xdg_cache_home(); std::filesystem::path xdg_data_home(); std::vector xdg_config_dirs(); -std::vector xdg_data_dirs(); +std::vector xdg_data_dirs(bool include_data_home = true);