Fix reading directly from the disc
Getting the file size with os.stat() does not work with block devices. You can now: libray -i /dev/sg0 -o test.iso
This commit is contained in:
parent
b9a9e6c18d
commit
4cec6b92e5
2 changed files with 14 additions and 4 deletions
|
|
@ -58,7 +58,10 @@ ISO_IV = to_bytes("69474772af6fdab342743aefaa186287")
|
|||
|
||||
def filesize(filename):
|
||||
"""Get size of a file in bytes from os.stat"""
|
||||
return os.stat(filename).st_size
|
||||
try:
|
||||
return open(filename, "rb").seek(0, 2)
|
||||
except:
|
||||
return os.stat(filename).st_size
|
||||
|
||||
|
||||
def read_seven_bit_encoded_int(fileobj, order):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue