Page 1 of 1

Making love executable how does it works?

Posted: Wed Sep 30, 2015 5:48 pm
by dominicus
Hi it's question to developers of Love.
To make My project executable on windows i use script

Code: Select all

@echo off
mkdir install
xcopy D:\LOVE\*.dll install\
copy /b D:\LOVE\love.exe+test.love install\my_game.exe
I copy zipped love project into love.exe. How love.exe knows how to find scripts when they copied into executable?
How luaL_dofile() function find scripts inside executable?
I'm asking because I want to apply this into my own project but I have no idea how.

Re: Making love executable how does it works?

Posted: Wed Sep 30, 2015 6:14 pm
by bartbes
This is a property of the zip file format, specifically. Because zips use footers, anything can be prepended to zips. Similarly, because exes use headers, anything can be appended to exes.

As for luaL_dofile, love doesn't use it, but rather implements its own filesystem (love.filesystem) and its own loader based on that and lua_loadstring (love.filesystem.load).

Re: Making love executable how does it works?

Posted: Sat Oct 17, 2015 10:51 am
by dominicus
Well I'm more interested in the implementation (probably in C/C++)... because i need to apply similar solution into my own project... i feel that this question will remain unanswered...

Re: Making love executable how does it works?

Posted: Sat Oct 17, 2015 11:21 am
by bartbes
Then you might want to ask more specific questions. As I said, appending zips to exes leaves the resulting file both a valid exe and a valid zip, so you can then use any zip reading code you'd like.