From 6f43438cdbfecf26d4bcf62a0d9ff71e40333ac2 Mon Sep 17 00:00:00 2001 From: cyn0x8 Date: Sat, 26 Apr 2025 18:26:09 -0700 Subject: [PATCH] hopefully fix #4814 --- source/funkin/modding/PolymodHandler.hx | 8 ++++++-- source/funkin/util/FileUtil.hx | 10 ++++------ 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/source/funkin/modding/PolymodHandler.hx b/source/funkin/modding/PolymodHandler.hx index 6ed966403..4ae1d46bc 100644 --- a/source/funkin/modding/PolymodHandler.hx +++ b/source/funkin/modding/PolymodHandler.hx @@ -80,8 +80,10 @@ class PolymodHandler */ public static function loadAllMods():Void { + #if sys // Create the mod root if it doesn't exist. createModRoot(); + #end trace('Initializing Polymod (using all mods)...'); loadModsById(getAllModIds()); } @@ -91,9 +93,10 @@ class PolymodHandler */ public static function loadEnabledMods():Void { + #if sys // Create the mod root if it doesn't exist. createModRoot(); - + #end trace('Initializing Polymod (using configured mods)...'); loadModsById(Save.instance.enabledModIds); } @@ -103,9 +106,10 @@ class PolymodHandler */ public static function loadNoMods():Void { + #if sys // Create the mod root if it doesn't exist. createModRoot(); - + #end // We still need to configure the debug print calls etc. trace('Initializing Polymod (using no mods)...'); loadModsById([]); diff --git a/source/funkin/util/FileUtil.hx b/source/funkin/util/FileUtil.hx index fa0af4235..3f47b6112 100644 --- a/source/funkin/util/FileUtil.hx +++ b/source/funkin/util/FileUtil.hx @@ -621,8 +621,6 @@ class FileUtil throw 'Target path is a directory, not a file: "$path"'; } - createDirIfNotExists(Path.directory(path)); - var shouldWrite:Bool = true; switch (mode) { @@ -811,14 +809,14 @@ class FileUtil */ public static function createDirIfNotExists(dir:String):Void { - #if sys if (!directoryExists(dir)) { + #if sys sys.FileSystem.createDirectory(dir); + #else + throw 'Directory creation is not supported on this platform.'; + #end } - #else - throw 'Directory creation is not supported on this platform.'; - #end } /**