Path: Add CreateFileURL()

This commit is contained in:
Stenzek
2024-03-13 19:39:10 +10:00
parent b9c9b05878
commit 9211d9f2e3
6 changed files with 132 additions and 77 deletions

View File

@ -1153,14 +1153,14 @@ bool GameList::DownloadCovers(const std::vector<std::string>& url_templates, boo
{
std::string url(url_template);
if (has_title)
StringUtil::ReplaceAll(&url, "${title}", HTTPDownloader::URLEncode(entry.title));
StringUtil::ReplaceAll(&url, "${title}", Path::URLEncode(entry.title));
if (has_file_title)
{
std::string display_name(FileSystem::GetDisplayNameFromPath(entry.path));
StringUtil::ReplaceAll(&url, "${filetitle}", HTTPDownloader::URLEncode(Path::GetFileTitle(display_name)));
StringUtil::ReplaceAll(&url, "${filetitle}", Path::URLEncode(Path::GetFileTitle(display_name)));
}
if (has_serial)
StringUtil::ReplaceAll(&url, "${serial}", HTTPDownloader::URLEncode(entry.serial));
StringUtil::ReplaceAll(&url, "${serial}", Path::URLEncode(entry.serial));
download_urls.emplace_back(entry.path, std::move(url));
}
@ -1201,7 +1201,7 @@ bool GameList::DownloadCovers(const std::vector<std::string>& url_templates, boo
}
// we could actually do a few in parallel here...
std::string filename(HTTPDownloader::URLDecode(url));
std::string filename = Path::URLDecode(url);
downloader->CreateRequest(
std::move(url), [use_serial, &save_callback, entry_path = std::move(entry_path), filename = std::move(filename)](
s32 status_code, const std::string& content_type, HTTPDownloader::Request::Data data) {