mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-03 02:15:43 -04:00
a bit more robustification
This commit is contained in:
parent
cf8d1ac8cd
commit
5de361dfd4
@ -458,10 +458,7 @@ choose_suitable_platform(string &selected_platform,
|
|||||||
const string &package_name,
|
const string &package_name,
|
||||||
const string &package_version,
|
const string &package_version,
|
||||||
const string &package_platform) {
|
const string &package_platform) {
|
||||||
nout << "choose_suitable_platform(" << package_name << ", "
|
|
||||||
<< package_version << ", " << package_platform << ")\n";
|
|
||||||
if (_xcontents == NULL) {
|
if (_xcontents == NULL) {
|
||||||
nout << " xcontents is null\n";
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -493,7 +490,6 @@ choose_suitable_platform(string &selected_platform,
|
|||||||
// Here's the matching package definition.
|
// Here's the matching package definition.
|
||||||
selected_platform = platform;
|
selected_platform = platform;
|
||||||
per_platform = parse_bool_attrib(xpackage, "per_platform", false);
|
per_platform = parse_bool_attrib(xpackage, "per_platform", false);
|
||||||
nout << " found match for " << selected_platform << "\n";
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -504,7 +500,6 @@ choose_suitable_platform(string &selected_platform,
|
|||||||
|
|
||||||
// Now, we look for an exact match for the expected platform.
|
// Now, we look for an exact match for the expected platform.
|
||||||
xpackage = _xcontents->FirstChildElement("package");
|
xpackage = _xcontents->FirstChildElement("package");
|
||||||
nout << " scanning, xpackage = " << xpackage << "\n";
|
|
||||||
while (xpackage != NULL) {
|
while (xpackage != NULL) {
|
||||||
const char *name = xpackage->Attribute("name");
|
const char *name = xpackage->Attribute("name");
|
||||||
const char *platform = xpackage->Attribute("platform");
|
const char *platform = xpackage->Attribute("platform");
|
||||||
@ -515,26 +510,21 @@ choose_suitable_platform(string &selected_platform,
|
|||||||
if (version == NULL) {
|
if (version == NULL) {
|
||||||
version = "";
|
version = "";
|
||||||
}
|
}
|
||||||
nout << " considering " << name << ", " << platform << ", " << version
|
|
||||||
<< "\n";
|
|
||||||
if (name != NULL &&
|
if (name != NULL &&
|
||||||
package_name == name &&
|
package_name == name &&
|
||||||
package_platform == platform &&
|
package_platform == platform &&
|
||||||
package_version == version) {
|
package_version == version) {
|
||||||
// Here's the matching package definition.
|
// Here's the matching package definition.
|
||||||
nout << " match!\n";
|
|
||||||
selected_platform = platform;
|
selected_platform = platform;
|
||||||
per_platform = parse_bool_attrib(xpackage, "per_platform", false);
|
per_platform = parse_bool_attrib(xpackage, "per_platform", false);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
nout << " no match.\n";
|
|
||||||
|
|
||||||
xpackage = xpackage->NextSiblingElement("package");
|
xpackage = xpackage->NextSiblingElement("package");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Look one more time, this time looking for a non-platform-specific
|
// Look one more time, this time looking for a non-platform-specific
|
||||||
// version.
|
// version.
|
||||||
nout << " further scanning\n";
|
|
||||||
xpackage = _xcontents->FirstChildElement("package");
|
xpackage = _xcontents->FirstChildElement("package");
|
||||||
while (xpackage != NULL) {
|
while (xpackage != NULL) {
|
||||||
const char *name = xpackage->Attribute("name");
|
const char *name = xpackage->Attribute("name");
|
||||||
@ -552,7 +542,6 @@ choose_suitable_platform(string &selected_platform,
|
|||||||
package_version == version) {
|
package_version == version) {
|
||||||
selected_platform = platform;
|
selected_platform = platform;
|
||||||
per_platform = parse_bool_attrib(xpackage, "per_platform", false);
|
per_platform = parse_bool_attrib(xpackage, "per_platform", false);
|
||||||
nout << " found empty platform\n";
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -560,7 +549,6 @@ choose_suitable_platform(string &selected_platform,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Couldn't find a suitable platform.
|
// Couldn't find a suitable platform.
|
||||||
nout << " couldn't find.\n";
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1369,6 +1369,17 @@ start_download(P3DPackage::DownloadType dtype, const string &urlbase,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (download->_try_urls.size() == 1) {
|
||||||
|
// If we only ended up with only one URL on the try list, then try
|
||||||
|
// it twice, for a bit of redundancy in case there's a random
|
||||||
|
// network hiccup or something.
|
||||||
|
|
||||||
|
// Save a copy into its own string object first to avoid
|
||||||
|
// self-dereferencing errors in the push_back() method.
|
||||||
|
string url = download->_try_urls[0];
|
||||||
|
download->_try_urls.push_back(url);
|
||||||
|
}
|
||||||
|
|
||||||
// OK, start the download.
|
// OK, start the download.
|
||||||
assert(!download->_try_urls.empty());
|
assert(!download->_try_urls.empty());
|
||||||
url = download->_try_urls.back();
|
url = download->_try_urls.back();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user