diff --git a/direct/src/p3d/coreapi.pdef b/direct/src/p3d/coreapi.pdef index 91763f9a87..2940b88031 100644 --- a/direct/src/p3d/coreapi.pdef +++ b/direct/src/p3d/coreapi.pdef @@ -19,6 +19,13 @@ from pandac.PandaModules import getModelPath, Filename, ConfigVariableFilename # Also see panda3d.pdef. +packager.setHost('file:///c:/cygwin/home/drose/p3dstage', + downloadUrl = 'file:///c:/cygwin/home/drose/p3dstage_1', + mirrors = ['file:///c:/cygwin/home/drose/mirror1', + 'file:///c:/cygwin/home/drose/mirror2', + 'http://www.ddrose.com/~drose/mirror3', + 'http://www.ddrose.com/~drose/mirror4']) + class coreapi(solo): # The special "coreapi" package. As a "solo", this is just a # single .dll (or dylib, or whatever). diff --git a/direct/src/plugin_activex/PPInstance.cpp b/direct/src/plugin_activex/PPInstance.cpp index 87723ca89e..bf8498f95e 100644 --- a/direct/src/plugin_activex/PPInstance.cpp +++ b/direct/src/plugin_activex/PPInstance.cpp @@ -162,28 +162,7 @@ read_contents_file(const string &contents_filename) { if (xcontents != NULL) { // Look for the entry; it might point us at a different // download URL, and it might mention some mirrors. - string host_url = PANDA_PACKAGE_HOST_URL; - TiXmlElement *xhost = xcontents->FirstChildElement("host"); - if (xhost != NULL) { - const char *url = xhost->Attribute("url"); - if (url != NULL && host_url == string(url)) { - // We're the primary host. This is the normal case. - read_xhost(xhost); - - } else { - // We're not the primary host; perhaps we're an alternate host. - TiXmlElement *xalthost = xhost->FirstChildElement("alt_host"); - while (xalthost != NULL) { - const char *url = xalthost->Attribute("url"); - if (url != NULL && host_url == string(url)) { - // Yep, we're this alternate host. - read_xhost(xhost); - break; - } - xalthost = xalthost->NextSiblingElement("alt_host"); - } - } - } + find_host(xcontents); // Now look for the core API package. TiXmlElement *xpackage = xcontents->FirstChildElement("package"); @@ -207,6 +186,43 @@ read_contents_file(const string &contents_filename) { return false; } +//////////////////////////////////////////////////////////////////// +// Function: PPInstance::find_host +// Access: Private +// Description: Scans the element for the matching +// element. +//////////////////////////////////////////////////////////////////// +void PPInstance:: +find_host(TiXmlElement *xcontents) { + string host_url = PANDA_PACKAGE_HOST_URL; + TiXmlElement *xhost = xcontents->FirstChildElement("host"); + if (xhost != NULL) { + const char *url = xhost->Attribute("url"); + if (url != NULL && host_url == string(url)) { + // We're the primary host. This is the normal case. + read_xhost(xhost); + return; + + } else { + // We're not the primary host; perhaps we're an alternate host. + TiXmlElement *xalthost = xhost->FirstChildElement("alt_host"); + while (xalthost != NULL) { + const char *url = xalthost->Attribute("url"); + if (url != NULL && host_url == string(url)) { + // Yep, we're this alternate host. + read_xhost(xhost); + return; + } + xalthost = xalthost->NextSiblingElement("alt_host"); + } + } + + // Hmm, didn't find the URL we used mentioned. Assume we're the + // primary host. + read_xhost(xhost); + } +} + //////////////////////////////////////////////////////////////////// // Function: PPInstance::read_xhost // Access: Private diff --git a/direct/src/plugin_activex/PPInstance.h b/direct/src/plugin_activex/PPInstance.h index 37e6ffa819..f9b5c48c0b 100644 --- a/direct/src/plugin_activex/PPInstance.h +++ b/direct/src/plugin_activex/PPInstance.h @@ -72,6 +72,7 @@ protected: int CopyFile( const std::string& from, const std::string& to ); bool read_contents_file(const std::string &contents_filename); + void find_host(TiXmlElement *xcontents); void read_xhost(TiXmlElement *xhost); void add_mirror(std::string mirror_url); void choose_random_mirrors(std::vector &result, int num_mirrors);