Skip to content

Commit

Permalink
fix: crash on startup when launching a secondary instance
Browse files Browse the repository at this point in the history
  • Loading branch information
timschneeb committed May 17, 2024
1 parent 27caebe commit 50b1738
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions GalaxyBudsClient/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,16 @@ public static void Main(string[] args)
var logPath = PlatformUtils.CombineDataPath("application.log");
var prevLogPath = PlatformUtils.CombineDataPath("application-prev.log");
// Rotate logs on startup
if (File.Exists(logPath))
File.Move(logPath, prevLogPath, true);

try
{
if (File.Exists(logPath))
File.Move(logPath, prevLogPath, true);
}
catch (Exception)
{
// Windows: exception is thrown when two instances are launched, because the first one is still using the log file
}

var config = new LoggerConfiguration()
.WriteTo.File(logPath)
.WriteTo.Console();
Expand Down

0 comments on commit 50b1738

Please sign in to comment.