parent
93f94361ed
commit
d35effd75d
|
@ -282,7 +282,17 @@ class Application(object):
|
|||
b = buffer.AesBuffer(path, password, name=name)
|
||||
else:
|
||||
raise Exception, "not a file or dir: %r" % path
|
||||
try:
|
||||
b.open()
|
||||
except buffer.BinaryDataException:
|
||||
if binary:
|
||||
raise
|
||||
else:
|
||||
binary = True
|
||||
b = buffer.Binary32Buffer(path, name=name)
|
||||
b.open()
|
||||
if mode_name is None:
|
||||
mode_name = 'hex'
|
||||
window.Window(b, self, height=0, width=0, mode_name=mode_name)
|
||||
self.add_buffer(b)
|
||||
return b
|
||||
|
@ -342,7 +352,12 @@ class Application(object):
|
|||
f.write(data)
|
||||
f.close()
|
||||
b = buffer.FileBuffer(path)
|
||||
try:
|
||||
b.open()
|
||||
except buffer.BinaryDataException:
|
||||
b = buffer.Binary32Buffer(path)
|
||||
b.open()
|
||||
b.modename = 'hex'
|
||||
window.Window(b, self, height=0, width=0)
|
||||
self.add_buffer(b)
|
||||
if switch_to:
|
||||
|
@ -902,6 +917,10 @@ if __name__ == "__main__":
|
|||
if opts.debug:
|
||||
mode.DEBUG = True
|
||||
|
||||
# if -b but no -m, then use -m hex
|
||||
if opts.binary and not opts.mode:
|
||||
opts.mode = 'hex'
|
||||
|
||||
# we will support using +19 as the first argument to indicate opening the
|
||||
# first file on line 19 (same as -g 19 or --goto 19)
|
||||
if goto_line:
|
||||
|
@ -941,6 +960,8 @@ if __name__ == "__main__":
|
|||
b = f(path, nl, name, opts.binary)
|
||||
b.open()
|
||||
except buffer.BinaryDataException, e:
|
||||
if not opts.mode:
|
||||
opts.mode = 'hex'
|
||||
b = f(path, nl, name, True)
|
||||
b.open()
|
||||
|
||||
|
|
Loading…
Reference in New Issue