From: Joel Rosdahl Date: Thu, 7 Nov 2024 20:54:27 +0000 (+0100) Subject: refactor: fs::path-ify helper functions in config.cpp X-Git-Tag: v4.11~48 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=fd473fc16be48ec667ebdf82e7251ee4f4fa0879;p=thirdparty%2Fccache.git refactor: fs::path-ify helper functions in config.cpp --- diff --git a/src/ccache/config.cpp b/src/ccache/config.cpp index e69a9aa2..d6b6bad5 100644 --- a/src/ccache/config.cpp +++ b/src/ccache/config.cpp @@ -489,31 +489,31 @@ create_cmdline_settings_map(const std::vector& settings) return result; } -} // namespace - #ifndef _WIN32 -static std::string -default_cache_dir(const std::string& home_dir) + +fs::path +default_cache_dir(const fs::path& home_dir) { # ifdef __APPLE__ - return home_dir + "/Library/Caches/ccache"; + return home_dir / "Library/Caches/ccache"; # else - return home_dir + "/.cache/ccache"; + return home_dir / ".cache/ccache"; # endif } -static std::string -default_config_dir(const std::string& home_dir) +fs::path +default_config_dir(const fs::path& home_dir) { # ifdef __APPLE__ - return home_dir + "/Library/Preferences/ccache"; + return home_dir / "Library/Preferences/ccache"; # else - return home_dir + "/.config/ccache"; + return home_dir / ".config/ccache"; # endif } -#endif -std::string +#endif // !_WIN32 + +fs::path home_directory() { #ifdef _WIN32 @@ -555,6 +555,8 @@ response_file_format_to_string(Args::ResponseFileFormat response_file_format) ASSERT(false); } +} // namespace + std::string compiler_type_to_string(CompilerType compiler_type) {