Fix race condition with duplicate instances

turns out it happens so quickly that not even having a file existence check right before opening it is sufficient enough
This commit is contained in:
pizzaboxer 2023-07-27 22:17:00 +01:00
parent e1013bf9b1
commit e0fcbaab2f
No known key found for this signature in database
GPG Key ID: 59D4A1DBAD0F2BA8

View File

@ -36,7 +36,15 @@
return; return;
} }
try
{
_filestream = File.Open(location, FileMode.Create, FileAccess.Write, FileShare.Read); _filestream = File.Open(location, FileMode.Create, FileAccess.Write, FileShare.Read);
}
catch (IOException)
{
WriteLine(LOG_IDENT, "Failed to initialize because log file already exists");
}
Initialized = true; Initialized = true;