Linux: Fixed crash when trying to start another instance (fixes file associations)

This commit is contained in:
Souryo 2017-09-08 20:10:30 -04:00
parent 4704c92317
commit ece3526b31
2 changed files with 15 additions and 2 deletions

View file

@ -14,8 +14,16 @@ namespace Mesen.GUI
{
private static void ExtractFile(ZipArchiveEntry entry, string outputFilename)
{
if(File.Exists(outputFilename)) {
try {
File.Delete(outputFilename);
} catch { }
}
try {
entry.ExtractToFile(outputFilename, true);
//On Mono, using overwrite = true for ExtractToFile crashes/kills any currently running instance that uses the file.
//This is probably a Mono bug?
//Better to attempt a delete & then extract, like now (and like it used to be)
entry.ExtractToFile(outputFilename);
} catch { }
}

View file

@ -36,6 +36,11 @@ namespace Mesen.GUI
} catch {
_firstInstance = false;
}
try {
if(File.Exists("mesen.arguments")) {
File.Delete("mesen.arguments");
}
} catch { }
} else {
this._identifier = new Guid("{A46606B7-2D1C-4CC5-A52F-43BCAF094AED}");
this._mutex = new Mutex(true, _identifier.ToString(), out _firstInstance);