mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-03 02:15:43 -04:00
oops, path error
This commit is contained in:
parent
671e3e5e85
commit
95420fe5b8
@ -10,13 +10,14 @@ class FileSpec:
|
|||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.actualFile = None
|
self.actualFile = None
|
||||||
|
|
||||||
def fromFile(self, packageDir, filename, st = None):
|
def fromFile(self, packageDir, filename, pathname = None, st = None):
|
||||||
""" Reads the file information from the indicated file. If st
|
""" Reads the file information from the indicated file. If st
|
||||||
is supplied, it is the result of os.stat on the filename. """
|
is supplied, it is the result of os.stat on the filename. """
|
||||||
|
|
||||||
vfs = VirtualFileSystem.getGlobalPtr()
|
vfs = VirtualFileSystem.getGlobalPtr()
|
||||||
|
|
||||||
filename = Filename(filename)
|
filename = Filename(filename)
|
||||||
|
if pathname is None:
|
||||||
pathname = Filename(packageDir, filename)
|
pathname = Filename(packageDir, filename)
|
||||||
|
|
||||||
self.filename = filename.cStr()
|
self.filename = filename.cStr()
|
||||||
@ -108,7 +109,7 @@ class FileSpec:
|
|||||||
|
|
||||||
# If the size is right but the timestamp is wrong, the file
|
# If the size is right but the timestamp is wrong, the file
|
||||||
# soft-fails. We follow this up with a hash check.
|
# soft-fails. We follow this up with a hash check.
|
||||||
if not self.checkHash(packageDir, st):
|
if not self.checkHash(packageDir, pathname, st):
|
||||||
# Hard fail, the hash is wrong.
|
# Hard fail, the hash is wrong.
|
||||||
#print "hash check wrong: %s" % (pathname)
|
#print "hash check wrong: %s" % (pathname)
|
||||||
return False
|
return False
|
||||||
@ -145,7 +146,7 @@ class FileSpec:
|
|||||||
#print "size wrong: %s" % (pathname)
|
#print "size wrong: %s" % (pathname)
|
||||||
return False
|
return False
|
||||||
|
|
||||||
if not self.checkHash(packageDir, st):
|
if not self.checkHash(packageDir, pathname, st):
|
||||||
# Hard fail, the hash is wrong.
|
# Hard fail, the hash is wrong.
|
||||||
#print "hash check wrong: %s" % (pathname)
|
#print "hash check wrong: %s" % (pathname)
|
||||||
return False
|
return False
|
||||||
@ -160,13 +161,14 @@ class FileSpec:
|
|||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def checkHash(self, packageDir, st):
|
def checkHash(self, packageDir, pathname, st):
|
||||||
""" Returns true if the file has the expected md5 hash, false
|
""" Returns true if the file has the expected md5 hash, false
|
||||||
otherwise. As a side effect, stores a FileSpec corresponding
|
otherwise. As a side effect, stores a FileSpec corresponding
|
||||||
to the on-disk file in self.actualFile. """
|
to the on-disk file in self.actualFile. """
|
||||||
|
|
||||||
fileSpec = FileSpec()
|
fileSpec = FileSpec()
|
||||||
fileSpec.fromFile(packageDir, self.filename, st = st)
|
fileSpec.fromFile(packageDir, self.filename,
|
||||||
|
pathname = pathname, st = st)
|
||||||
self.actualFile = fileSpec
|
self.actualFile = fileSpec
|
||||||
|
|
||||||
return (fileSpec.hash == self.hash)
|
return (fileSpec.hash == self.hash)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user