diff --git a/src/libstore/store-dir-config.cc b/src/libstore/store-dir-config.cc index 8c756ff5819..6d95ac09e8b 100644 --- a/src/libstore/store-dir-config.cc +++ b/src/libstore/store-dir-config.cc @@ -49,7 +49,13 @@ StorePathSet StoreDirConfig::parseStorePathSet(const PathSet & paths) const std::string StoreDirConfig::printStorePath(const StorePath & path) const { - return (storeDir + "/").append(path.to_string()); + std::string res; + auto baseName = path.to_string(); + res.reserve(storeDir.size() + 1 + baseName.size()); + res.append(storeDir); + res.push_back('/'); + res.append(baseName); + return res; } PathSet StoreDirConfig::printStorePathSet(const StorePathSet & paths) const