Update client-side story name when saving

If you save a story as a different name than it was loaded with, and
then try to download it as JSON/plaintext, the downloaded file's name
will now match the new story name.
This commit is contained in:
Gnome Ann 2021-09-19 23:40:52 -04:00
parent 12264bbdd8
commit 8df2ccae5b
1 changed files with 5 additions and 0 deletions

View File

@ -2050,6 +2050,11 @@ def saveRequest(savpath):
return e return e
file.close() file.close()
filename = path.basename(savpath)
if(filename.endswith('.json')):
filename = filename[:-5]
vars.laststory = filename
emit('from_server', {'cmd': 'setstoryname', 'data': vars.laststory}, broadcast=True)
print("{0}Story saved to {1}!{2}".format(colors.GREEN, path.basename(savpath), colors.END)) print("{0}Story saved to {1}!{2}".format(colors.GREEN, path.basename(savpath), colors.END))
#==================================================================# #==================================================================#