From 1864153b9acc06d77542f9d1bff33e4849466473 Mon Sep 17 00:00:00 2001 From: Thomas Geymayer Date: Thu, 26 Jun 2014 18:11:41 +0200 Subject: [PATCH] canvas.gui.MessageBox: Ensure path for saving selections exists. --- Nasal/canvas/gui/dialogs/MessageBox.nas | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Nasal/canvas/gui/dialogs/MessageBox.nas b/Nasal/canvas/gui/dialogs/MessageBox.nas index 76e6065d3..03485a9a9 100644 --- a/Nasal/canvas/gui/dialogs/MessageBox.nas +++ b/Nasal/canvas/gui/dialogs/MessageBox.nas @@ -189,7 +189,7 @@ var MessageBox = { _loadSelection: func { var dlg_id = md5(me._title ~ me._text ~ me._standard_buttons); - me._save_path = getprop("/sim/fg-home") ~ "/cache/MessageBox-" ~ dlg_id; + me._save_path = getprop("/sim/fg-home") ~ "/cache/MessageBox/sel-" ~ dlg_id; if( io.stat(me._save_path) != nil ) { @@ -203,6 +203,9 @@ var MessageBox = { { printlog("info", "Saving dialog selection to '" ~ me._save_path ~ "'"); + # ensure directory exists + os.path.new(me._save_path).create_dir(); + var fh = io.open(me._save_path, "w"); io.write(fh, '' ~ sel); io.close(fh);