From 9a8bda8b1172d28c3f11adabb51a6013bb98c26f Mon Sep 17 00:00:00 2001 From: Hyper_ <40342021+NotHyper-474@users.noreply.github.com> Date: Tue, 16 Sep 2025 14:51:19 -0300 Subject: [PATCH] this should be running last... --- source/funkin/util/logging/AnsiTrace.hx | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/source/funkin/util/logging/AnsiTrace.hx b/source/funkin/util/logging/AnsiTrace.hx index 2c01363f5..b4500d456 100644 --- a/source/funkin/util/logging/AnsiTrace.hx +++ b/source/funkin/util/logging/AnsiTrace.hx @@ -1,6 +1,7 @@ package funkin.util.logging; #if (sys && FEATURE_DEBUG_FILE_LOGGING) +import flixel.math.FlxMath; import sys.FileSystem; import sys.io.FileOutput; import sys.io.File; @@ -15,6 +16,7 @@ class AnsiTrace #if (sys && FEATURE_DEBUG_FILE_LOGGING) private static final logFileName:String = "logs.txt"; private static var logFile:Null = null; + private static var logFileClosed:Bool = false; #end /** @@ -45,9 +47,12 @@ class AnsiTrace logFile = File.write(logFileName); - lime.app.Application.current.onExit.add((_) -> logFile.close()); + lime.app.Application.current.onExit.add((_) -> { + logFile.close(); + logFileClosed = true; + }, true, FlxMath.MIN_VALUE_INT); } - if (logFile != null) logFile.writeString(logStr); + if (logFile != null && !logFileClosed) logFile.writeString(logStr); #end Sys.println(str); #else