mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-09-04 03:35:19 +02:00
http: Use Path for the download file.
This commit is contained in:
@@ -457,7 +457,7 @@ int Client::ReadResponseEntity(net::Buffer *readbuf, const std::vector<std::stri
|
||||
return 0;
|
||||
}
|
||||
|
||||
Download::Download(const std::string &url, const std::string &outfile)
|
||||
Download::Download(const std::string &url, const Path &outfile)
|
||||
: progress_(&cancelled_), url_(url), outfile_(outfile) {
|
||||
}
|
||||
|
||||
@@ -552,12 +552,12 @@ void Download::Do() {
|
||||
}
|
||||
|
||||
if (resultCode == 200) {
|
||||
INFO_LOG(IO, "Completed downloading %s to %s", url_.c_str(), outfile_.empty() ? "memory" : outfile_.c_str());
|
||||
if (!outfile_.empty() && !buffer_.FlushToFile(outfile_.c_str())) {
|
||||
ERROR_LOG(IO, "Failed writing download to %s", outfile_.c_str());
|
||||
INFO_LOG(IO, "Completed downloading %s to %s", url_.c_str(), outfile_.empty() ? "memory" : outfile_.ToVisualString().c_str());
|
||||
if (!outfile_.empty() && !buffer_.FlushToFile(outfile_)) {
|
||||
ERROR_LOG(IO, "Failed writing download to %s", outfile_.ToVisualString().c_str());
|
||||
}
|
||||
} else {
|
||||
ERROR_LOG(IO, "Error downloading %s to %s: %i", url_.c_str(), outfile_.c_str(), resultCode);
|
||||
ERROR_LOG(IO, "Error downloading %s to %s: %i", url_.c_str(), outfile_.ToVisualString().c_str(), resultCode);
|
||||
}
|
||||
resultCode_ = resultCode;
|
||||
}
|
||||
@@ -569,7 +569,7 @@ void Download::Do() {
|
||||
completed_ = true;
|
||||
}
|
||||
|
||||
std::shared_ptr<Download> Downloader::StartDownload(const std::string &url, const std::string &outfile) {
|
||||
std::shared_ptr<Download> Downloader::StartDownload(const std::string &url, const Path &outfile) {
|
||||
std::shared_ptr<Download> dl(new Download(url, outfile));
|
||||
downloads_.push_back(dl);
|
||||
dl->Start();
|
||||
@@ -578,7 +578,7 @@ std::shared_ptr<Download> Downloader::StartDownload(const std::string &url, cons
|
||||
|
||||
std::shared_ptr<Download> Downloader::StartDownloadWithCallback(
|
||||
const std::string &url,
|
||||
const std::string &outfile,
|
||||
const Path &outfile,
|
||||
std::function<void(Download &)> callback) {
|
||||
std::shared_ptr<Download> dl(new Download(url, outfile));
|
||||
dl->SetCallback(callback);
|
||||
|
||||
Reference in New Issue
Block a user