From adefa902e79620a2be717969a63c151be6464307 Mon Sep 17 00:00:00 2001 From: EliteMasterEric Date: Fri, 25 Apr 2025 14:48:37 -0400 Subject: [PATCH] Fix several issues preventing builds on HTML5 --- hmm.json | 2 +- source/funkin/util/FileUtil.hx | 14 ++++++++++++-- source/funkin/util/WindowUtil.hx | 8 ++++++++ source/funkin/util/macro/RegistryMacro.hx | 3 +-- 4 files changed, 22 insertions(+), 5 deletions(-) diff --git a/hmm.json b/hmm.json index 41624948c..406a2a1d7 100644 --- a/hmm.json +++ b/hmm.json @@ -143,7 +143,7 @@ "name": "lime", "type": "git", "dir": null, - "ref": "1e79c20a6ee13fa168535f9f76a368e3284ddc3a", + "ref": "be81ad7e4e1a92c3482bcc009648a4ac892cfa35", "url": "https://github.com/FunkinCrew/lime" }, { diff --git a/source/funkin/util/FileUtil.hx b/source/funkin/util/FileUtil.hx index a5eda796b..cf9109bcf 100644 --- a/source/funkin/util/FileUtil.hx +++ b/source/funkin/util/FileUtil.hx @@ -53,7 +53,17 @@ class FileUtil * Paths which should not be deleted or modified by scripts. */ private static final PROTECTED_PATHS:Array = [ - '', 'assets', 'manifest', 'manifest/*', 'plugins', 'plugins/*', 'Funkin.exe', 'Funkin', 'libvlc.dll', 'libvlccore.dll', 'lime.ndll' + '', + 'assets', + 'manifest', + 'manifest/*', + 'plugins', + 'plugins/*', + 'Funkin.exe', + 'Funkin', + 'libvlc.dll', + 'libvlccore.dll', + 'lime.ndll' ]; /** @@ -269,7 +279,7 @@ class FileUtil return true; #elseif html5 - var filter:String = defaultFileName != null ? Path.extension(defaultFileName) : null; + var filter:Null = defaultFileName != null ? Path.extension(defaultFileName) : null; var fileDialog:FileDialog = new FileDialog(); if (onSave != null) { diff --git a/source/funkin/util/WindowUtil.hx b/source/funkin/util/WindowUtil.hx index 665512e5b..c6d8bee6a 100644 --- a/source/funkin/util/WindowUtil.hx +++ b/source/funkin/util/WindowUtil.hx @@ -69,6 +69,9 @@ class WindowUtil */ public static function openFolder(targetPath:String):Void { + #if html5 + throw 'Cannot open URLs on this platform.'; + #else if (!sys.FileSystem.exists(targetPath) || !sys.FileSystem.isDirectory(targetPath)) throw 'openFolder should only be used to open existing folders.'; #if FEATURE_OPEN_URL #if windows @@ -81,6 +84,7 @@ class WindowUtil #else throw 'Cannot open URLs on this platform.'; #end + #end } /** @@ -89,6 +93,9 @@ class WindowUtil */ public static function openSelectFile(targetPath:String):Void { + #if html5 + throw 'Cannot open URLs on this platform.'; + #else #if FEATURE_OPEN_URL #if windows Sys.command('explorer', ['/select,' + targetPath.replace('/', '\\')]); @@ -101,6 +108,7 @@ class WindowUtil #else throw 'Cannot open URLs on this platform.'; #end + #end } /** diff --git a/source/funkin/util/macro/RegistryMacro.hx b/source/funkin/util/macro/RegistryMacro.hx index bc16e92be..e7c0d401e 100644 --- a/source/funkin/util/macro/RegistryMacro.hx +++ b/source/funkin/util/macro/RegistryMacro.hx @@ -8,7 +8,6 @@ import haxe.macro.Expr.TypeDefKind; import haxe.macro.Expr.MetadataEntry; import haxe.macro.Type; import haxe.macro.Type.ClassType; -import sys.FileSystem; using Lambda; using haxe.macro.ExprTools; @@ -362,7 +361,7 @@ class RegistryMacro static function listBaseGameEntryIds(dataFilePath:String):Array { var result:Array = []; - var files:Array = FileSystem.readDirectory(dataFilePath); + var files:Array = sys.FileSystem.readDirectory(dataFilePath); for (file in files) {