mirror of
https://github.com/robmcmullen/atrcopy.git
synced 2024-11-25 16:32:07 +00:00
Disk image filenames should be str, not encoded bytes
This commit is contained in:
parent
8747e7e26b
commit
7e3159b175
@ -130,11 +130,10 @@ class DiskImageBase(object):
|
||||
return Directory
|
||||
|
||||
def set_filename(self, filename):
|
||||
if type(filename) is not bytes: filename = filename.encode("utf-8")
|
||||
if b'.' in filename:
|
||||
self.filename, self.ext = filename.rsplit(b'.', 1)
|
||||
if '.' in filename:
|
||||
self.filename, self.ext = filename.rsplit('.', 1)
|
||||
else:
|
||||
self.filename, self.ext = filename, b''
|
||||
self.filename, self.ext = filename, ''
|
||||
|
||||
def dir(self):
|
||||
lines = []
|
||||
@ -180,10 +179,9 @@ class DiskImageBase(object):
|
||||
if not filename:
|
||||
filename = self.filename
|
||||
if self.ext:
|
||||
filename += b'.' + self.ext
|
||||
filename += '.' + self.ext
|
||||
if not filename:
|
||||
raise RuntimeError("No filename specified for save!")
|
||||
if type(filename) is not bytes: filename = filename.encode("utf-8")
|
||||
data = self.bytes[:]
|
||||
with open(filename, "wb") as fh:
|
||||
data.tofile(fh)
|
||||
|
Loading…
Reference in New Issue
Block a user