1
0
Fork 0

canvas.gui.MessageBox: Ensure path for saving selections exists.

This commit is contained in:
Thomas Geymayer 2014-06-26 18:11:41 +02:00
parent 0f692bf89c
commit 1864153b9a

View file

@ -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);