]> git.ipfire.org Git - thirdparty/ccache.git/commitdiff
refactor: fs::path-ify is_ccache_executable
authorJoel Rosdahl <joel@rosdahl.net>
Wed, 2 Aug 2023 11:01:38 +0000 (13:01 +0200)
committerJoel Rosdahl <joel@rosdahl.net>
Wed, 2 Aug 2023 14:02:12 +0000 (16:02 +0200)
src/ccache.cpp
src/ccache.hpp

index 904dca3883bbd44886e7d7ee89a827404e771a4f..705878fd27b5f2df454873dce44a450d94fdf32a 100644 (file)
@@ -2668,9 +2668,9 @@ do_cache_compilation(Context& ctx)
 }
 
 bool
-is_ccache_executable(const std::string_view path)
+is_ccache_executable(const fs::path& path)
 {
-  std::string name(Util::base_name(path));
+  std::string name = path.filename().string();
 #ifdef _WIN32
   name = util::to_lowercase(name);
 #endif
index 3d8072e6f77983aa637d6763a420432078baf825..7fe12359ad8f8c6b475460fefa2f425f4522a6b8 100644 (file)
@@ -22,6 +22,7 @@
 #include <Args.hpp>
 #include <Config.hpp>
 
+#include <filesystem>
 #include <functional>
 #include <string>
 #include <string_view>
@@ -52,4 +53,4 @@ void find_compiler(Context& ctx,
                    const FindExecutableFunction& find_executable_function,
                    bool masquerading_as_compiler);
 CompilerType guess_compiler(std::string_view path);
-bool is_ccache_executable(std::string_view path);
+bool is_ccache_executable(const std::filesystem::path& path);