diff --git a/CHANGELOG b/CHANGELOG index 1fa1076..bd442ff 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -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) diff --git a/offpunk.py b/offpunk.py index f3862e7..0f9cc9f 100755 --- a/offpunk.py +++ b/offpunk.py @@ -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: