From 98aa59f85a7fad50b84bba951244f9d20b9babbf Mon Sep 17 00:00:00 2001 From: Cameron Taylor Date: Tue, 21 Nov 2023 01:37:49 -0500 Subject: [PATCH] open log on debug menu --- source/funkin/ui/debug/DebugMenuSubState.hx | 21 ++++++++++++++++++++- source/funkin/util/logging/CrashHandler.hx | 2 +- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/source/funkin/ui/debug/DebugMenuSubState.hx b/source/funkin/ui/debug/DebugMenuSubState.hx index ef02a802e..e1f340770 100644 --- a/source/funkin/ui/debug/DebugMenuSubState.hx +++ b/source/funkin/ui/debug/DebugMenuSubState.hx @@ -7,6 +7,7 @@ import funkin.ui.MusicBeatSubState; import funkin.ui.TextMenuList; import funkin.ui.debug.charting.ChartEditorState; import funkin.ui.MusicBeatSubState; +import funkin.util.logging.CrashHandler; class DebugMenuSubState extends MusicBeatSubState { @@ -50,7 +51,9 @@ class DebugMenuSubState extends MusicBeatSubState createItem("ANIMATION EDITOR", openAnimationEditor); createItem("STAGE EDITOR", openStageEditor); createItem("TEST STICKERS", testStickers); - + #if sys + createItem("OPEN CRASH LOG FOLDER", openLogFolder); + #end FlxG.camera.focusOn(new FlxPoint(camFocusPoint.x, camFocusPoint.y)); FlxG.camera.focusOn(new FlxPoint(camFocusPoint.x, camFocusPoint.y + 500)); } @@ -101,6 +104,22 @@ class DebugMenuSubState extends MusicBeatSubState trace('Stage Editor'); } + #if sys + function openLogFolder() + { + #if windows + Sys.command('explorer', [CrashHandler.LOG_FOLDER]); + #elseif mac + // mac could be fuckie with where the log folder is relative to the game file... + // if this comment is still here... it means it has NOT been verified on mac yet! + Sys.command('open', [CrashHandler.LOG_FOLDER]); + #end + + // TODO: implement linux + // some shit with xdg-open :thinking: emoji... + } + #end + function exitDebugMenu() { // TODO: Add a transition? diff --git a/source/funkin/util/logging/CrashHandler.hx b/source/funkin/util/logging/CrashHandler.hx index 9d1d3f1b9..e254909eb 100644 --- a/source/funkin/util/logging/CrashHandler.hx +++ b/source/funkin/util/logging/CrashHandler.hx @@ -9,7 +9,7 @@ import openfl.events.UncaughtErrorEvent; @:nullSafety class CrashHandler { - static final LOG_FOLDER = 'logs'; + public static final LOG_FOLDER = 'logs'; /** * Initializes