From 15ffbf2fe7657f8d6d73c873c8c96e09f7231fc5 Mon Sep 17 00:00:00 2001 From: EliteMasterEric Date: Wed, 1 Nov 2023 23:09:52 -0400 Subject: [PATCH] Fixed a MacOS-specific issue --- source/funkin/util/CLIUtil.hx | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/source/funkin/util/CLIUtil.hx b/source/funkin/util/CLIUtil.hx index a085ada6d..0ca707c34 100644 --- a/source/funkin/util/CLIUtil.hx +++ b/source/funkin/util/CLIUtil.hx @@ -1,5 +1,7 @@ package funkin.util; +import haxe.io.Path; + /** * Utilties for interpreting command line arguments. */ @@ -13,9 +15,20 @@ class CLIUtil public static function resetWorkingDir():Void { #if sys - var exeDir:String = haxe.io.Path.directory(Sys.programPath()); - trace('Changing working directory from ${Sys.getCwd()} to ${exeDir}'); - Sys.setCwd(exeDir); + var exeDir:String = Path.addTrailingSlash(Path.directory(Sys.programPath())); + #if mac + exeDir = Path.addTrailingSlash(Path.join([exeDir, '../Resources/'])); + #end + var cwd:String = Path.addTrailingSlash(Sys.getCwd()); + if (cwd == exeDir) + { + trace('Working directory is already correct.'); + } + else + { + trace('Changing working directory from ${Sys.getCwd()} to ${exeDir}'); + Sys.setCwd(exeDir); + } #end }