From b9d3842380a484b326331aa41e45ea84de48757a Mon Sep 17 00:00:00 2001 From: David Rose Date: Thu, 24 Dec 2009 19:27:13 +0000 Subject: [PATCH] add perPlatform option --- direct/src/p3d/HostInfo.py | 15 +++++++++++++-- direct/src/p3d/PackageInfo.py | 8 +++++--- 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/direct/src/p3d/HostInfo.py b/direct/src/p3d/HostInfo.py index 56b1412adf..9ddf423240 100644 --- a/direct/src/p3d/HostInfo.py +++ b/direct/src/p3d/HostInfo.py @@ -10,7 +10,7 @@ class HostInfo: class in the core API. """ def __init__(self, hostUrl, appRunner = None, hostDir = None, - asMirror = False): + asMirror = False, perPlatform = None): """ You must specify either an appRunner or a hostDir to the HostInfo constructor. @@ -21,7 +21,15 @@ class HostInfo: This means when you use this HostInfo to download packages, it will only download the compressed archive file and leave it there. At the moment, mirror folders do not download old - patch files from the server. """ + patch files from the server. + + If you pass perPlatform = True, then files are unpacked into a + platform-specific directory, which is appropriate when you + might be downloading multiple platforms. The default is + perPlatform = False, which means all files are unpacked into + the host directory directly, without an intervening + platform-specific directory name. If asMirror is True, then + the default is perPlatform = True. """ assert appRunner or hostDir @@ -29,6 +37,9 @@ class HostInfo: self.appRunner = appRunner self.hostDir = hostDir self.asMirror = asMirror + self.perPlatform = perPlatform + if perPlatform is None: + self.perPlatform = asMirror # hostUrlPrefix is the host URL, but it is guaranteed to end # with a slash. diff --git a/direct/src/p3d/PackageInfo.py b/direct/src/p3d/PackageInfo.py index 6fc422bae9..d26c043951 100644 --- a/direct/src/p3d/PackageInfo.py +++ b/direct/src/p3d/PackageInfo.py @@ -110,9 +110,11 @@ class PackageInfo: if self.packageVersion: self.packageDir = Filename(self.packageDir, self.packageVersion) - if self.asMirror: - # The server directory contains the platform name, though - # the client directory doesn't. + if self.host.perPlatform: + # The server directory contains the platform name, + # though the client directory normally doesn't (unless + # perPlatform is set true). + if self.platform: self.packageDir = Filename(self.packageDir, self.platform)