validate core API host URL and core API set_ver

This commit is contained in:
David Rose 2010-06-16 17:02:57 +00:00
parent edab904b87
commit ab2d5eb61e
2 changed files with 32 additions and 1 deletions

View File

@ -291,9 +291,36 @@ set_plugin_version(int major, int minor, int sequence,
_plugin_sequence_version = sequence; _plugin_sequence_version = sequence;
_plugin_official_version = official; _plugin_official_version = official;
_plugin_distributor = distributor; _plugin_distributor = distributor;
// The Core API "host URL" is both compiled in, and comes in
// externally; we trust the external source in the case of a
// conflict.
string internal_host_url = PANDA_PACKAGE_HOST_URL;
if (coreapi_host_url != internal_host_url) {
nout << "Warning! Downloaded Core API from " << coreapi_host_url
<< ", but its internal URL was " << internal_host_url << "\n";
}
_coreapi_host_url = coreapi_host_url; _coreapi_host_url = coreapi_host_url;
if (_coreapi_host_url.empty()) {
_coreapi_host_url = internal_host_url;
}
// The Core API timestamp is only available externally.
_coreapi_timestamp = coreapi_timestamp; _coreapi_timestamp = coreapi_timestamp;
_coreapi_set_ver = coreapi_set_ver;
// The Core API "set ver", or version, is both compiled in and comes
// in externally; for this one we trust the internal version in the
// case of a conflict.
string internal_set_ver = P3D_COREAPI_VERSION_STR;
if (coreapi_set_ver != internal_set_ver && !coreapi_set_ver.empty() && !internal_set_ver.empty()) {
nout << "Warning! contents.xml reports Core API version number "
<< coreapi_set_ver << ", but its actual version number is "
<< internal_set_ver << "\n";
}
_coreapi_set_ver = internal_set_ver;
if (_coreapi_set_ver.empty()) {
_coreapi_set_ver = coreapi_set_ver;
}
nout << "Plugin version: " nout << "Plugin version: "
<< _plugin_major_version << "." << _plugin_major_version << "."

View File

@ -10,6 +10,10 @@
"coreapi" package should be found at this location. */ "coreapi" package should be found at this location. */
#$[]define PANDA_PACKAGE_HOST_URL "$[PANDA_PACKAGE_HOST_URL]" #$[]define PANDA_PACKAGE_HOST_URL "$[PANDA_PACKAGE_HOST_URL]"
/* The Core API version number. This one also appears in
pandaVersion.h. */
#$[]define P3D_COREAPI_VERSION_STR "$[join .,$[P3D_COREAPI_VERSION]]"
/* The filename(s) to generate output to when the plugin is running. /* The filename(s) to generate output to when the plugin is running.
For debugging purposes only. */ For debugging purposes only. */
#$[]define P3D_PLUGIN_LOG_DIRECTORY "$[subst \,\\,$[osfilename $[P3D_PLUGIN_LOG_DIRECTORY]]]" #$[]define P3D_PLUGIN_LOG_DIRECTORY "$[subst \,\\,$[osfilename $[P3D_PLUGIN_LOG_DIRECTORY]]]"