Game Launcher

It should work on Linux, but I didn’t test it personally. rdb did mention on IRC he tried to use it and it worked on linux (the only problem he mentioned was that the included demo got lunched full-screen and I didn’t put any way to close it :blush: ).

The update function is very simplistic. This it how it works:

  1. Download a file from a url written in the setup.json file (eg. basic{“update_url”:“some://url.dot.com/file.json”})

  2. The downloaded file is expected to be a json file with urls of files to download, this is what I used for the demo:

[
{"url":"https://rawgit.com/wezu/p3d_launcher/master/update_0.zip", "target":"update_1.zip"}
]

It’s a list containing a dict, so you could add more files like this

[
{"url":"https://rawgit.com/wezu/p3d_launcher/master/update_0.zip", "target":"update_1.zip"},
{"url":"https://some.place.on/the/internet/update_1.zip", "target":"update_2.zip"},
{"url":"http://i.am.making/this/url/up", "target":"some_other_update.zip"}
]

The “target” in this dict is the name of the file that’s going to be written on the clients disc, so the url may point to “update_0.zip” but it can just as well be written as “update_123.zip” on the client.

For each file mentioned there, the launcher will check if a file with that name exist on the client machine, if it’s not there it will download the file (or at least try to).

  1. Each downloaded zip file is extracted overriding any files with the same name (I’ve included the zipfile implementation from 2.7.10, because in versions lower then 2.7.4 had a bug that allowed to extract files outside the current directory, and that could be a bad thing).

  2. Finally the launcher walks its own directory deleting all files with 0 size (this is for the occasion where an update should delete files).

So to get the updates from the net, you just need a hosting service that gives direct links to files. I think it might work directly with github if you point it to the “Download zip” url, but I haven’t tested that. For the demo I used rawgit.com that gives a permanent(-ish?) link to github files and placed the update.zip directly inside the repo. I imagine this should work with google drive and/or dropbox as well.

As a side note - if anyone knows a pure python library that could pull from a git repo, let me know :wink: