]> git.ipfire.org Git - thirdparty/ccache.git/commitdiff
Fix bug in debug_dir (CCACHE_DEBUGDIR)
authorJoel Rosdahl <joel@rosdahl.net>
Sun, 4 Jul 2021 05:13:02 +0000 (07:13 +0200)
committerJoel Rosdahl <joel@rosdahl.net>
Sun, 4 Jul 2021 10:12:16 +0000 (12:12 +0200)
The absolute path to the object file is not created correctly if the
object file doesn’t already exist.

src/ccache.cpp

index a7cc3a3135354295b3c75ecbfca8dc63acaf12ef..cdaf8ffcb9b0a47c5724ec12686ece9f069d844e 100644 (file)
@@ -232,8 +232,12 @@ prepare_debug_path(const std::string& debug_dir,
                    const std::string& output_obj,
                    string_view suffix)
 {
-  const std::string prefix =
-    debug_dir.empty() ? output_obj : debug_dir + Util::real_path(output_obj);
+  auto prefix = debug_dir.empty()
+                  ? output_obj
+                  : debug_dir + util::to_absolute_path(output_obj);
+#ifdef _WIN32
+  prefix.erase(std::remove(prefix.begin(), prefix.end(), ':'), prefix.end());
+#endif
   try {
     Util::ensure_dir_exists(Util::dir_name(prefix));
   } catch (Error&) {