Mac patch for easier distribution. Where should I send it?
Posted: Wed Dec 30, 2009 2:45 am
The Mac distribution setup sucks, as described in this thread. So I decided to contribute a patch. I don't know SDL or Lua at all, and barely any Cocoa, but I get the ideas behind all of them and I want Löve to be as effective as possible on OS X because I like the project.
Someone suggested that love.app should simply check its own love.app/Contents/Resources folder for .love files and run the first one it finds, and even provided a code sample for how that might be done. It turned out to be a little more complicated than that, but not much more after I figured out what was going on. Basically, if löve decides that it's been launched from the Finder, then it does what it normally does upon drag-and-drop or a file open from the Finder: it rewrites gArgv to use that file and blocks gArgv from being rewritten again. It finds the file using Cocoa's resource-finding routines (given in the code sample, which I have since lost.) Then it releases memory properly, and execution continues as normal.
You'll have to update Info.plist as normal. That's just a Mac thing. I might write you guys an Automator script or something to do that more easily. It's really not difficult.
At any rate, the process for distribution with this patch is about 5 steps shorter. Just drop a .love in to love.app/Contents/Resources, rename love.app, and tweak Info.plist to show the correct name in the menu. Bam. Done.
I couldn't figure out where to clone or check out from, so I ended up using this Mercurial repository, which appears to be up to date.
Now I don't know how to submit the patch, so here's the Mercurial patch, and here's the text of the addition (It's just one 34-line chunk in SDLMain.m, just copy and paste it in, or throw it in a function, whatever). What is the proper channel for this? The site could benefit from a "how to contribute" page.
If you're a "normal person" here, then you can use the version I built locally. Download it here. I have NO IDEA if it works for anyone else, and I didn't pay much attention to the build process. (While we're here, could one of you devs tell me how to unmount this damn disk image?)
ANYWAYS
Hi, I'm Steve. Here's my web site. I like to write games and Mac software. I usually use Python and pyglet to do that, and I like them very much. But Lua intrigues me, so I've been checking out löve periodically, and you seem like my kind of folks. Keep it up.
Someone suggested that love.app should simply check its own love.app/Contents/Resources folder for .love files and run the first one it finds, and even provided a code sample for how that might be done. It turned out to be a little more complicated than that, but not much more after I figured out what was going on. Basically, if löve decides that it's been launched from the Finder, then it does what it normally does upon drag-and-drop or a file open from the Finder: it rewrites gArgv to use that file and blocks gArgv from being rewritten again. It finds the file using Cocoa's resource-finding routines (given in the code sample, which I have since lost.) Then it releases memory properly, and execution continues as normal.
You'll have to update Info.plist as normal. That's just a Mac thing. I might write you guys an Automator script or something to do that more easily. It's really not difficult.
At any rate, the process for distribution with this patch is about 5 steps shorter. Just drop a .love in to love.app/Contents/Resources, rename love.app, and tweak Info.plist to show the correct name in the menu. Bam. Done.
I couldn't figure out where to clone or check out from, so I ended up using this Mercurial repository, which appears to be up to date.
Now I don't know how to submit the patch, so here's the Mercurial patch, and here's the text of the addition (It's just one 34-line chunk in SDLMain.m, just copy and paste it in, or throw it in a function, whatever). What is the proper channel for this? The site could benefit from a "how to contribute" page.
If you're a "normal person" here, then you can use the version I built locally. Download it here. I have NO IDEA if it works for anyone else, and I didn't pay much attention to the build process. (While we're here, could one of you devs tell me how to unmount this damn disk image?)
ANYWAYS
Hi, I'm Steve. Here's my web site. I like to write games and Mac software. I usually use Python and pyglet to do that, and I like them very much. But Lua intrigues me, so I've been checking out löve periodically, and you seem like my kind of folks. Keep it up.