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:
parent
056b02a494
commit
39b2a3d6df
14
ws/ws.cpp
14
ws/ws.cpp
@ -1427,10 +1427,16 @@ namespace ix
|
||||
filename = output;
|
||||
}
|
||||
|
||||
spdlog::info("Writing to disk: {}", filename);
|
||||
std::ofstream out(filename);
|
||||
out.write((char*) &response->body.front(), response->body.size());
|
||||
out.close();
|
||||
if (filename.empty())
|
||||
{
|
||||
spdlog::error("Cannot save content to disk: No output file supplied, and not filename could be extracted from the url {}", url);
|
||||
}
|
||||
else
|
||||
{
|
||||
spdlog::info("Writing to disk: {}", filename);
|
||||
std::ofstream out(filename);
|
||||
out << response->body;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user