fix a crash when saving a folder
This commit is contained in:
parent
1e16c415fd
commit
517e0f0e9e
|
@ -1,5 +1,8 @@
|
|||
# Offpunk History
|
||||
|
||||
## 1.2 - Unreleased
|
||||
- Fixed a crash when trying to save a folder
|
||||
|
||||
## 1.1 - March 18th 2022
|
||||
- Perfect rendering of pictures with chafa 1.8+ and compatible terminal (Kitty)
|
||||
- timg is supported as an alternative to chafa (with a little glitch)
|
||||
|
|
|
@ -3214,8 +3214,12 @@ see "handler" command to set your own."""
|
|||
# Don't use _get_active_tmpfile() here, because we want to save the
|
||||
# "source code" of menus, not the rendered view - this way Offpunk
|
||||
# can navigate to it later.
|
||||
print("Saved to %s" % filename)
|
||||
shutil.copyfile(gi.get_body(as_file=True), filename)
|
||||
path = gi.get_body(as_file=True)
|
||||
if os.path.isdir(path):
|
||||
print("Can’t save %s because it’s a folder, not a file"%path)
|
||||
else:
|
||||
print("Saved to %s" % filename)
|
||||
shutil.copyfile(path, filename)
|
||||
|
||||
# Restore gi if necessary
|
||||
if index != None:
|
||||
|
|
Loading…
Reference in New Issue