]> git.ipfire.org Git - thirdparty/ccache.git/commitdiff
fix: Handle directory-less path to /FI
authorJoel Rosdahl <joel@rosdahl.net>
Thu, 9 Apr 2026 07:28:23 +0000 (09:28 +0200)
committerJoel Rosdahl <joel@rosdahl.net>
Sat, 11 Apr 2026 07:10:26 +0000 (09:10 +0200)
src/ccache/argprocessing.cpp

index fbb4a8b12b6b5ef81ebde496b74bf2954d4b4c4f..5fc70ecd2ac8e96ef6b27d8fbf8cd4ff18f5cf99 100644 (file)
@@ -1558,14 +1558,14 @@ process_args(Context& ctx)
 
   // Special case: rewrite /FI arguments relative to the input file.
   if (state.rewrite_FI_args) {
-    auto r = fs::canonical(args_info.input_file.parent_path());
+    auto r = fs::canonical(args_info.input_file);
     if (!r) {
       LOG("Failed to convert {} to absolute: {}",
-          args_info.input_file.parent_path(),
+          args_info.input_file,
           r.error());
       return tl::unexpected(Statistic::internal_error);
     }
-    const auto& abs_input_file_dir = *r;
+    auto abs_input_file_dir = r->parent_path();
     auto rewrite = [&](util::Args& arglist, size_t& i) {
       if (arglist[i].starts_with("/FI") || arglist[i].starts_with("-FI")) {
         if (arglist[i].length() > 3) {