From 70409443d177cac201ad987d52cfbf570a18de14 Mon Sep 17 00:00:00 2001 From: George FunBook Date: Mon, 29 Mar 2021 23:05:21 -0500 Subject: [PATCH] fix errors on mac --- source/MainMenuState.hx | 2 +- source/ui/ModMenu.hx | 16 ++++++++++++---- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/source/MainMenuState.hx b/source/MainMenuState.hx index bdcbd277c..96e67351a 100644 --- a/source/MainMenuState.hx +++ b/source/MainMenuState.hx @@ -24,7 +24,7 @@ import ui.Prompt; using StringTools; -#if desktop +#if discord_rpc import Discord.DiscordClient; #end #if newgrounds diff --git a/source/ui/ModMenu.hx b/source/ui/ModMenu.hx index 7fed9b4bb..7ee0e55a1 100644 --- a/source/ui/ModMenu.hx +++ b/source/ui/ModMenu.hx @@ -83,6 +83,7 @@ class ModMenu extends ui.OptionsState.Page organizeByY(); } + inline static var MOD_PATH = "./mods"; private function refreshModList():Void { while (grpMods.members.length > 0) @@ -93,16 +94,23 @@ class ModMenu extends ui.OptionsState.Page #if desktop var modList = []; modFolders = []; - - for (file in FileSystem.readDirectory('./mods')) + + trace("mods path:" + FileSystem.absolutePath(MOD_PATH)); + if (!FileSystem.exists(MOD_PATH)) { - if (FileSystem.isDirectory('./mods/' + file)) + FlxG.log.warn("missing mods folder, expected: " + FileSystem.absolutePath(MOD_PATH)); + return; + } + + for (file in FileSystem.readDirectory(MOD_PATH)) + { + if (FileSystem.isDirectory(MOD_PATH + file)) modFolders.push(file); } enabledMods = []; - modList = Polymod.scan('./mods'); + modList = Polymod.scan(MOD_PATH); trace(modList);