Linux: Fixed crash when trying to start another instance (fixes file associations)
This commit is contained in:
parent
4704c92317
commit
ece3526b31
2 changed files with 15 additions and 2 deletions
|
@ -14,8 +14,16 @@ namespace Mesen.GUI
|
||||||
{
|
{
|
||||||
private static void ExtractFile(ZipArchiveEntry entry, string outputFilename)
|
private static void ExtractFile(ZipArchiveEntry entry, string outputFilename)
|
||||||
{
|
{
|
||||||
|
if(File.Exists(outputFilename)) {
|
||||||
try {
|
try {
|
||||||
entry.ExtractToFile(outputFilename, true);
|
File.Delete(outputFilename);
|
||||||
|
} catch { }
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
//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 { }
|
} catch { }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -36,6 +36,11 @@ namespace Mesen.GUI
|
||||||
} catch {
|
} catch {
|
||||||
_firstInstance = false;
|
_firstInstance = false;
|
||||||
}
|
}
|
||||||
|
try {
|
||||||
|
if(File.Exists("mesen.arguments")) {
|
||||||
|
File.Delete("mesen.arguments");
|
||||||
|
}
|
||||||
|
} catch { }
|
||||||
} else {
|
} else {
|
||||||
this._identifier = new Guid("{A46606B7-2D1C-4CC5-A52F-43BCAF094AED}");
|
this._identifier = new Guid("{A46606B7-2D1C-4CC5-A52F-43BCAF094AED}");
|
||||||
this._mutex = new Mutex(true, _identifier.ToString(), out _firstInstance);
|
this._mutex = new Mutex(true, _identifier.ToString(), out _firstInstance);
|
||||||
|
|
Loading…
Add table
Reference in a new issue