fix deleting recent roms when missing

This commit is contained in:
zeromus 2016-08-17 20:23:56 -05:00
parent 9d594e013b
commit 94383ab143
2 changed files with 11 additions and 6 deletions

View File

@ -140,7 +140,9 @@ namespace BizHawk.Client.EmuHawk.ToolExtensions
//in any case, make a menuitem to let you remove the item
var tsmiRemovePath = new ToolStripMenuItem { Text = "&Remove" };
tsmiRemovePath.Click += (o, ev) => { recent.Remove(path); };
tsmiRemovePath.Click += (o, ev) => {
recent.Remove(path);
};
tsdd.Items.Add(tsmiRemovePath);
////experiment of popping open a submenu. doesnt work well.
@ -210,7 +212,7 @@ namespace BizHawk.Client.EmuHawk.ToolExtensions
return items.ToArray();
}
public static void HandleLoadError(this RecentFiles recent, string path)
public static void HandleLoadError(this RecentFiles recent, string path, string encodedPath = null)
{
GlobalWin.Sound.StopSound();
if (recent.Frozen)
@ -222,7 +224,10 @@ namespace BizHawk.Client.EmuHawk.ToolExtensions
var result = MessageBox.Show("Could not open " + path + "\nRemove from list?", "File not found", MessageBoxButtons.YesNo, MessageBoxIcon.Error);
if (result == DialogResult.Yes)
{
recent.Remove(path);
if (encodedPath != null)
recent.Remove(encodedPath);
else
recent.Remove(path);
}
}

View File

@ -1770,11 +1770,11 @@ namespace BizHawk.Client.EmuHawk
};
//if(ioa is this or that) - for more complex behaviour
rom = ioa.SimplePath;
string romPath = ioa.SimplePath;
if (!LoadRom(rom, args))
if (!LoadRom(romPath, args))
{
Global.Config.RecentRoms.HandleLoadError(rom);
Global.Config.RecentRoms.HandleLoadError(romPath, rom);
}
}