mirror of
https://github.com/bloxstraplabs/bloxstrap.git
synced 2025-04-16 02:01:29 -07:00
Exit if duplicate launch detected (#212)
amendment to the fix for that issue - the prior fix was to just allow two instances to launch that probably isn't great for the user, so it's better to just terminate if it detects a duplicate launch, and that only happens if two launches happen within the same second so lol
This commit is contained in:
parent
0a7ae17473
commit
34b6fef148
@ -209,6 +209,13 @@ namespace Bloxstrap
|
||||
if (!IsFirstRun)
|
||||
{
|
||||
Logger.Initialize(IsUninstall);
|
||||
|
||||
if (!Logger.Initialized)
|
||||
{
|
||||
Logger.WriteLine("[App::OnStartup] Possible duplicate launch detected, terminating.");
|
||||
Terminate();
|
||||
}
|
||||
|
||||
Settings.Load();
|
||||
State.Load();
|
||||
FastFlags.Load();
|
||||
|
@ -32,10 +32,19 @@ namespace Bloxstrap
|
||||
WriteLine($"[Logger::Initialize] Initializing at {location}");
|
||||
|
||||
if (Initialized)
|
||||
throw new Exception("Logger is already initialized");
|
||||
{
|
||||
WriteLine("[Logger::Initialize] Failed to initialize because logger is already initialized");
|
||||
return;
|
||||
}
|
||||
|
||||
Directory.CreateDirectory(directory);
|
||||
|
||||
if (File.Exists(location))
|
||||
{
|
||||
WriteLine("[Logger::Initialize] Failed to initialize because log file already exists");
|
||||
return;
|
||||
}
|
||||
|
||||
_filestream = File.Open(location, FileMode.Create, FileAccess.Write, FileShare.Read);
|
||||
|
||||
if (Backlog.Count > 0)
|
||||
|
Loading…
Reference in New Issue
Block a user