From c70df0a2da123885e2149145e0c4f74d0bc29d22 Mon Sep 17 00:00:00 2001 From: Bernardo Meurer Costa Date: Sat, 11 Oct 2025 20:21:44 +0000 Subject: [PATCH] refactor(libstore/find-cycles): use std::filesystem::path operator/ Replace string concatenation for path joining with type-safe `std::filesystem::path operator/`. --- src/libstore/build/find-cycles.cc | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/libstore/build/find-cycles.cc b/src/libstore/build/find-cycles.cc index aea0e348c..3a2c10aa8 100644 --- a/src/libstore/build/find-cycles.cc +++ b/src/libstore/build/find-cycles.cc @@ -106,12 +106,14 @@ void scanForCycleEdges2(const std::string & path, CycleEdgeScanSink & sink) std::string name(entryName); size_t pos = entryName.find(caseHackSuffix); if (pos != std::string::npos) { - debug("removing case hack suffix from '%s'", path + "/" + entryName); + debug("removing case hack suffix from '%s'", (fsPath / entryName).string()); name.erase(pos); } if (unhacked.find(name) != unhacked.end()) { throw Error( - "file name collision between '%1%' and '%2%'", path + "/" + unhacked[name], path + "/" + entryName); + "file name collision between '%1%' and '%2%'", + (fsPath / unhacked[name]).string(), + (fsPath / entryName).string()); } unhacked[name] = entryName; #else @@ -121,7 +123,7 @@ void scanForCycleEdges2(const std::string & path, CycleEdgeScanSink & sink) for (auto & [name, actualName] : unhacked) { debug("scanForCycleEdges2: recursing into %s/%s", path, actualName); - scanForCycleEdges2(path + "/" + actualName, sink); + scanForCycleEdges2((fsPath / actualName).string(), sink); } } else if (std::filesystem::is_symlink(status)) { // Handle symlinks - stream link target into sink