[vcpkg-export] Fix nuget export. Fixes
MODIFY
src/commands_export.cpp
src/commands_export.cpp
@@ -122,6 +122,10 @@ namespace vcpkg::Commands::Export
const std::string targets_redirect_content =
create_targets_redirect("../../scripts/buildsystems/msbuild/vcpkg.targets");
const fs::path targets_redirect = paths.buildsystems / "tmp" / "vcpkg.export.nuget.targets";
+
+ std::error_code ec;
+ fs.create_directories(paths.buildsystems / "tmp", ec);
+
fs.write_contents(targets_redirect, targets_redirect_content);
const std::string nuspec_file_content =

MODIFY
src/vcpkg_Files.cpp
src/vcpkg_Files.cpp
@@ -164,7 +164,8 @@ namespace vcpkg::Files
{
FILE* f = nullptr;
auto ec = _wfopen_s(&f, file_path.native().c_str(), L"wb");
- Checks::check_exit(VCPKG_LINE_INFO, ec == 0);
+ Checks::check_exit(
+ VCPKG_LINE_INFO, ec == 0, "Error: Could not open file for writing: %s", file_path.u8string().c_str());
auto count = fwrite(data.data(), sizeof(data[0]), data.size(), f);
fclose(f);

[vcpkg-export] Fix nuget export. Fixes #1223.