Skip to content

Commit

Permalink
Try converting path to canonical before calling string()
Browse files Browse the repository at this point in the history
  • Loading branch information
tuokri committed Sep 4, 2024
1 parent b40a1df commit 68decfa
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -571,7 +571,7 @@ void clang_format(const std::vector<fs::path>& paths)
for (const auto& path: paths)
{
const auto style_arg = std::format("--style=file:{}", cf_cfg_file.string());
const auto& pstr = path.string();
const auto& pstr = fs::canonical(path).string();

Check warning on line 574 in src/main.cpp

View workflow job for this annotation

GitHub Actions / ubuntu-24.04-Debug-CMake build and tests

possibly dangling reference to a temporary [-Wdangling-reference]

Check warning on line 574 in src/main.cpp

View workflow job for this annotation

GitHub Actions / ubuntu-24.04-Release-CMake build and tests

possibly dangling reference to a temporary [-Wdangling-reference]
std::cout << std::format("running clang-format on '{}'\n", pstr);
bp::execute(bp::process(ctx, cf_prog, {pstr, style_arg, "-i", "--Werror"}));
// TODO: check exit code and throw on clang_format failure?
Expand Down

0 comments on commit 68decfa

Please sign in to comment.