mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Try to preserve the timestamps of files in a ZIP container
This commit is contained in:
commit
0a2ddcb44b
@ -352,7 +352,7 @@ The syntax for searching for dates is::
|
|||||||
If the date is ambiguous, the current locale is used for date comparison. For example, in an mm/dd/yyyy
|
If the date is ambiguous, the current locale is used for date comparison. For example, in an mm/dd/yyyy
|
||||||
locale, 2/1/2009 is interpreted as 1 Feb 2009. In a dd/mm/yyyy locale, it is interpreted as 2 Jan 2009. Some
|
locale, 2/1/2009 is interpreted as 1 Feb 2009. In a dd/mm/yyyy locale, it is interpreted as 2 Jan 2009. Some
|
||||||
special date strings are available. The string ``today`` translates to today's date, whatever it is. The
|
special date strings are available. The string ``today`` translates to today's date, whatever it is. The
|
||||||
strings `yesterday`` and ``thismonth`` also work. In addition, the string ``daysago`` can be used to compare
|
strings ``yesterday`` and ``thismonth`` also work. In addition, the string ``daysago`` can be used to compare
|
||||||
to a date some number of days ago, for example: date:>10daysago, date:<=45daysago.
|
to a date some number of days ago, for example: date:>10daysago, date:<=45daysago.
|
||||||
|
|
||||||
You can search for books that have a format of a certain size like this::
|
You can search for books that have a format of a certain size like this::
|
||||||
|
@ -1123,6 +1123,13 @@ class ZipFile:
|
|||||||
targetpath = os.sep.join(components)
|
targetpath = os.sep.join(components)
|
||||||
with open(targetpath, 'wb') as target:
|
with open(targetpath, 'wb') as target:
|
||||||
shutil.copyfileobj(source, target)
|
shutil.copyfileobj(source, target)
|
||||||
|
# Kovid: Try to preserve the timestamps in the ZIP file
|
||||||
|
try:
|
||||||
|
mtime = time.localtime()
|
||||||
|
mtime = time.mktime(member.date_time + (0, 0) + (mtime.tm_isdst,))
|
||||||
|
os.utime(targetpath, (mtime, mtime))
|
||||||
|
except:
|
||||||
|
pass
|
||||||
self.extract_mapping[member.filename] = targetpath
|
self.extract_mapping[member.filename] = targetpath
|
||||||
return targetpath
|
return targetpath
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user