Closed rdw-software closed 1 year ago
I remember there were many problems with VFS lookups and path resolution, if trying to load files from the bundle. To avoid that and still enable the most important functionality (loading files from the bundle, without re-architecting the app), I'd consider something like the following to be a decent starting point for further refinements:
import
function can be used in scripts (bundled or otherwise)require("some.dir")
paths)require
after converting the path to a dot-separator formatThis would solve multiple problems at once:
.evo
folder, as in evo-luvi)import
everywhere even if the app is not meant to be bundledrequired
Edit: This would still introduce some complexity and a sort-of "module system", which I'm not a fan of. Maybe it's more sensible to just start with the "always load main.lua
from the archive and everything else must be present on disk" approach first?
Also, since main.lua
has access to miniz
and everything, more complex processing could be implemented as needed (by users).
I actually ran into some more problems: The offset computation breaks down for large files (>8MB) in miniz. It seems the Luvit fork modified the code for this in mz_zip_reader_read_central_dir
and other parts, which means there are two options:
I dislike both of these, so I choose option 3: Screw this and revisit it later, maybe. It's not that important right now, anyway.
OK, actually I hate giving up... Let's survey first the actual list of changes (diff between Luvit miniz and upstream):
Since using upstream miniz makes it impossible to implement zip apps and using the Luvit fork is putting extra maintenance work on me (or them, if there are bugs in the fork itself or upstream changes need to be integrated), a workaround is needed.
Prototyping some ideas, the following solution might work - but it introduces some extra complexity:
executable zip-app
doesn't work without modifying miniz, introduce a (slightly modified) "zip app" formatminiz
bindingThis has been confirmed to work with the current executable size (21MB on Windows, which is beyond the 8MB limit).
Potential advantages:
Now, to the disadvantages:
7zip
or unzip
, may not be able to deal with it (unzip
still works, and 7zip
didn't before anyway)So overall it seems like a workable solution, albeit not an ideal one. The rest depends on how much should be added on top.
Similar to what evo-luvi (and luvi) can do, though I remember there were quite a few kinks that needed to be ironed out.
See also: https://docs.python.org/3/library/zipapp.html
Goals:
evo build
) to create a zip archive that runs as a standalone appmain.lua
entry pointEvo-luvi (and luvi itself) have some extra options like setting a different entry point. I'd rather avoid that, at least for now.