ENH:rename model file after download finish

Change-Id: I3ae1c8ca4f53bf41c00688b6bb5b0c0e0a4f869b
This commit is contained in:
tao wang 2023-04-20 12:45:26 +08:00 committed by Lane.Wei
parent 2dbd2bcef9
commit 8ceb0e6b7b
3 changed files with 33 additions and 16 deletions

View file

@ -7776,14 +7776,31 @@ int Plater::save_project(bool saveAs)
//BBS import model by model id
void Plater::import_model_id(const std::string& download_info)
{
std::string download_origin_url = wxGetApp().url_decode(download_info);
std::string download_url;
std::string filename;
std::string download_origin_url = wxGetApp().url_decode(download_info);
fs::path download_path = fs::path(download_origin_url);
download_url = download_origin_url;
filename = download_path.filename().string();
try
{
std::vector<std::string> origin_array = wxGetApp().split_str(download_origin_url, "&name=");
if (origin_array.size() >= 2) {
download_url = origin_array[0];
filename = origin_array[1];
}
else if (!download_origin_url.empty()) {
fs::path download_path = fs::path(download_origin_url);
download_url = download_origin_url;
filename = download_path.filename().string();
}
}
catch (const std::exception& error)
{
//wxString sError = error.what();
}
bool download_ok = false;
/* save to a file */