ws curl -O mingw compile fix + detect when we cannot extract a filename from the url to save file to disk with -O option

This commit is contained in:
Benjamin Sergeant 2021-03-19 11:35:25 -07:00
parent 056b02a494
commit 39b2a3d6df

View File

@ -1427,10 +1427,16 @@ namespace ix
filename = output; filename = output;
} }
spdlog::info("Writing to disk: {}", filename); if (filename.empty())
std::ofstream out(filename); {
out.write((char*) &response->body.front(), response->body.size()); spdlog::error("Cannot save content to disk: No output file supplied, and not filename could be extracted from the url {}", url);
out.close(); }
else
{
spdlog::info("Writing to disk: {}", filename);
std::ofstream out(filename);
out << response->body;
}
} }
else else
{ {