Skip to content

Commit b16771f

Browse files
committed
Avoid forming a Json::Object that we just throw away.
1 parent df9ea71 commit b16771f

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/vcpkg/commands.set-installed.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -278,16 +278,16 @@ namespace vcpkg
278278
}
279279
}
280280

281-
if (auto manifest = paths.get_manifest().get())
281+
const auto manifest = paths.get_manifest().get();
282+
const auto installed_paths = paths.maybe_installed().get();
283+
if (manifest && installed_paths)
282284
{
285+
// See docs/manifest-info.schema.json
283286
Json::Object manifest_info;
284287
manifest_info.insert("manifest-path", Json::Value::string(manifest->path));
285-
if (const auto installed_paths = paths.maybe_installed().get())
286-
{
287-
const auto json_file_path = installed_paths->vcpkg_dir() / FileManifestInfo;
288-
const auto json_contents = Json::stringify(manifest_info);
289-
fs.write_contents(json_file_path, json_contents, VCPKG_LINE_INFO);
290-
}
288+
const auto json_file_path = installed_paths->vcpkg_dir() / FileManifestInfo;
289+
const auto json_contents = Json::stringify(manifest_info);
290+
fs.write_contents(json_file_path, json_contents, VCPKG_LINE_INFO);
291291
}
292292

293293
Checks::exit_success(VCPKG_LINE_INFO);

0 commit comments

Comments
 (0)