mirror of
https://github.com/mon/ifstools.git
synced 2024-11-27 18:40:48 +01:00
Fix files with no timestamp
This commit is contained in:
parent
042f3697db
commit
16b0f761a0
@ -8,7 +8,13 @@ from .. import utils
|
||||
|
||||
class GenericFile(Node):
|
||||
def from_xml(self, element):
|
||||
self.start, self.size, self.time = self._split_ints(element.text)
|
||||
info = self._split_ints(element.text)
|
||||
# sometimes we don't get a timestamp
|
||||
if len(info) == 2:
|
||||
self.start, self.size = info
|
||||
self.time = -1
|
||||
else:
|
||||
self.start, self.size, self.time = info
|
||||
|
||||
def from_filesystem(self, folder):
|
||||
self.base_path = self.parent.base_path
|
||||
|
@ -21,4 +21,6 @@ def save_with_timestamp(filename, data, timestamp):
|
||||
mkdir_silent(os.path.dirname(filename))
|
||||
with open(filename, 'wb') as f:
|
||||
f.write(data)
|
||||
# we store invalid timestamps as -1
|
||||
if timestamp >= 0:
|
||||
os.utime(filename, (timestamp,timestamp))
|
||||
|
Loading…
Reference in New Issue
Block a user