Workaround to lime-legacy not providing access to lime classes

157 Views Asked by At

I'm using HaxePunk 2.5.6 with OpenFL 3.6.1 and Lime 2.9.1 ; I read in an issue on the HaxeFlixel GitHub that Lime prevents access to its classes on legacy. That's a big problem, because HaxePunk uses legacy by default. I want to use lime.ui.FileDialog to open and save files, but since HaxePunk is stuck with legacy, obviously that doesn't work (lime.ui.FileDialog reads as null instead of Class<lime.ui.FileDialog> ...). Is there a workaround to this ? I didn't see anything in OpenFL that replaces this, so I'm really lost. Obviously I don't want to install any additional lib unless it's really necessary. Using -Dnext or -Dhybrid when compiling to override -Dlegacy breaks everything, so that's not a solution either.

Thanks by advance !

1

There are 1 best solutions below

4
On

You could go to <haxelib directory>/lime/2,9,1/legacy and undo the changes to include.xml in the relevant commit by removing this line:

<haxeflag name="--macro" value="exclude('lime')" />

However, as described in this thread, this adds a dependency to lime.ndll (as opposed to lime-legacy.ndll, which is the only one being copied to /bin for legacy builds), so your binary would crash when shipped to other computers that don't have a Haxe installation.

You can work around this by manually copying lime.ndll over (or add <ndll name="lime" dir="ndll" /> to legacy's include.xml), but using a third-party library like systools or linc_dialogs would be a cleaner solution.