Commit Graph

9 Commits

Author SHA1 Message Date
dgelessus
e6779b021a Replace rsrcfork.open's rsrcfork parameter with a more usable version
The new fork parameter accepts strings, which are more understandable
than the old None/True/False values, and can be extended in the future.
2019-08-31 20:07:26 +02:00
dgelessus
acdbbc89b2 Improve automatic fork selection when resource fork is invalid 2019-08-30 23:17:59 +02:00
dgelessus
d7fb67fac1 Add better error checking for invalid resource files 2019-08-30 23:17:59 +02:00
dgelessus
5ede8a351a Rework how non-seekable streams are handled by ResourceFile
The broken non-seeking read implementation of ResourceFile is removed,
and non-seekable streams are now handled by reading the entire stream
data first and wrapping it in a BytesIO to make it seekable.

The manual selection of seeking/non-seeking reading has been removed as
well, since it is no longer needed and was already nearly useless.
2019-08-30 23:17:18 +02:00
dgelessus
2fb1d02064 Add initial support for compressed resources
Not all compression formats are supported yet.
2019-07-14 02:16:49 +02:00
dgelessus
a9a3168345 Change flag enum definitions to use bit shift instead of literals
Bit shifts are easier to read and less error-prone than typing the
values out by hand.
2018-02-25 17:11:39 +01:00
dgelessus
0b8699c2f1 Do not close user-supplied streams in ResourceFork.close by default
When using ResourceFork.open, the stream is still closed when the
ResourceFile is closed, because the user has no access to the stream.
This matches the behavior of modules like zipfile and tarfile, which
close their underlying streams if they created them themselves, but not
if they were supplied by the user.
2018-02-16 22:47:36 +01:00
dgelessus
2dbf0f7047 Fix ResourceFork.open and __init__ not closing streams in some cases 2018-02-16 22:30:18 +01:00
dgelessus
cbc55fcbc2 Refactor rsrcfork.py into a package 2018-02-12 22:48:46 +01:00