diff options
| author | Felix Morgner <felix.morgner@gmail.com> | 2018-12-08 10:43:50 +0100 |
|---|---|---|
| committer | Felix Morgner <felix.morgner@gmail.com> | 2018-12-08 10:43:50 +0100 |
| commit | 0c1d1a0f24655c22a373c19aac90a6a225a353e6 (patch) | |
| tree | e65fe3c5f8b80bb59910c81c700eb3ed545848bb /src/xdg.cpp | |
| parent | f22d1b76c9a957a679b57ddcb67b33cc73a15de1 (diff) | |
| download | wanda-0c1d1a0f24655c22a373c19aac90a6a225a353e6.tar.xz wanda-0c1d1a0f24655c22a373c19aac90a6a225a353e6.zip | |
wanda: reformat source code
Diffstat (limited to 'src/xdg.cpp')
| -rw-r--r-- | src/xdg.cpp | 33 |
1 files changed, 16 insertions, 17 deletions
diff --git a/src/xdg.cpp b/src/xdg.cpp index 9293151..10f3603 100644 --- a/src/xdg.cpp +++ b/src/xdg.cpp @@ -4,44 +4,43 @@ namespace wanda { - -std::string xdg_variable(xdg_directory directory) -{ + std::string xdg_variable(xdg_directory directory) + { switch (directory) { - case xdg_directory::data_home: + case xdg_directory::data_home: return "XDG_DATA_HOME"; - case xdg_directory::config_home: + case xdg_directory::config_home: return "XDG_CONFIG_HOME"; - case xdg_directory::cache_home: + case xdg_directory::cache_home: return "XDG_CACHE_HOME"; - case xdg_directory::runtime_dir: + case xdg_directory::runtime_dir: return "XDG_RUNTIME_DIR"; } return "XDG_INVALID_PATH"; -} + } -std::filesystem::path xdg_path_for(xdg_directory directory, environment const &environment) -{ + std::filesystem::path xdg_path_for(xdg_directory directory, environment const & environment) + { if (auto path = environment[xdg_variable(directory)]; !path.empty()) { - return path; + return path; } auto home = std::filesystem::path{environment["HOME"]}; switch (directory) { - case xdg_directory::data_home: + case xdg_directory::data_home: return home / ".local/share"; - case xdg_directory::config_home: + case xdg_directory::config_home: return home / ".config"; - case xdg_directory::cache_home: + case xdg_directory::cache_home: return home / ".cache"; - case xdg_directory::runtime_dir: + case xdg_directory::runtime_dir: return std::filesystem::path{"/run/user"} / std::to_string(::getuid()); } return ""; -} + } -} // namespace wanda
\ No newline at end of file +} // namespace wanda
\ No newline at end of file |
