Skip to content

Commit

Permalink
Avoid forming a Json::Object that we just throw away.
Browse files Browse the repository at this point in the history
  • Loading branch information
BillyONeal committed Jan 17, 2025
1 parent df9ea71 commit b16771f
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/vcpkg/commands.set-installed.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -278,16 +278,16 @@ namespace vcpkg
}
}

if (auto manifest = paths.get_manifest().get())
const auto manifest = paths.get_manifest().get();
const auto installed_paths = paths.maybe_installed().get();
if (manifest && installed_paths)
{
// See docs/manifest-info.schema.json
Json::Object manifest_info;
manifest_info.insert("manifest-path", Json::Value::string(manifest->path));
if (const auto installed_paths = paths.maybe_installed().get())
{
const auto json_file_path = installed_paths->vcpkg_dir() / FileManifestInfo;
const auto json_contents = Json::stringify(manifest_info);
fs.write_contents(json_file_path, json_contents, VCPKG_LINE_INFO);
}
const auto json_file_path = installed_paths->vcpkg_dir() / FileManifestInfo;
const auto json_contents = Json::stringify(manifest_info);
fs.write_contents(json_file_path, json_contents, VCPKG_LINE_INFO);
}

Checks::exit_success(VCPKG_LINE_INFO);
Expand Down

0 comments on commit b16771f

Please sign in to comment.