]> git.ipfire.org Git - thirdparty/ccache.git/commitdiff
refactor: fs::path-ify helper functions in config.cpp
authorJoel Rosdahl <joel@rosdahl.net>
Thu, 7 Nov 2024 20:54:27 +0000 (21:54 +0100)
committerJoel Rosdahl <joel@rosdahl.net>
Sat, 9 Nov 2024 12:59:05 +0000 (13:59 +0100)
src/ccache/config.cpp

index e69a9aa2e5e3087846808930394eda7dd9d03991..d6b6bad5128f5ec424e8fefc9b9278547e051180 100644 (file)
@@ -489,31 +489,31 @@ create_cmdline_settings_map(const std::vector<std::string>& 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)
 {