Haxe desktop apps that auto-update -- anyone done it?

320 views
Skip to first unread message

Jeff Ward

unread,
May 22, 2015, 4:20:11 PM5/22/15
to haxe...@googlegroups.com
Hi all,

Has anybody investigated whether / how a Haxe app could auto-update itself? I'm thinking native/cpp targets for desktop / non-mobile, specifically, but perhaps it applies to others platforms.

Self/auto-updating apps, usually with a simple "Install new update?" pop-up message, are very popular these days (e.g. Google Chrome, OSX, etc.)

Right now I've just started thinking about this. I think I could handle the in-app code to check for updates from a download server, but I have a lot of questions on the haxe / ndll / binary side:
  • Is it possible to librarize Haxe outputs, and control when those libraries are loaded?
  • Where frameworks are concerned (e.g. OpenFL, snow), there are extra .ndll / lib files deployed -- can we control when those are loaded so-as to be able to update them before they're in use?
  • Are the separate implications for OSX / Win / Linux?
  • I suppose another possibility is to have a separate launcher/updater app that can perform updates on the main app, so-as to avoid complexity in the main app?
If anyone has considered this before, I'd be interested in what you've learned.

Thanks,
-Jeff

Benjamin Dubois

unread,
May 23, 2015, 1:53:52 AM5/23/15
to haxe...@googlegroups.com
Maybe you could look into Omaha (Google updater)
https://code.google.com/p/omaha/

From my understanding it runs only on windows .

--
To post to this group haxe...@googlegroups.com
http://groups.google.com/group/haxelang?hl=en
---
You received this message because you are subscribed to the Google Groups "Haxe" group.
For more options, visit https://groups.google.com/d/optout.

Franco Ponticelli

unread,
May 23, 2015, 2:14:02 AM5/23/15
to haxe...@googlegroups.com
Electron (former Atom-Shell https://github.com/atom/electron) comes with an auto-updating feature and it is multi OS.

Lars Doucet

unread,
May 23, 2015, 2:12:53 PM5/23/15
to haxe...@googlegroups.com
hey, I actually did this in Adobe AIR, and I'm sure the implementation could be ported to Haxe without too much trouble. There's nothing "magical" too it, it's just basic HTTPS requests and some fairly standard crypto (sign a build with your private key before you upload it to your server, then put the public key in your app).

If you don't want to do any security validation whatsoever, it's even easier! When I have some time I'll post the details.

Hugh

unread,
May 25, 2015, 2:02:53 AM5/25/15
to haxe...@googlegroups.com
Cpp now has:
cpp.Lib.unloadAllLibraries
After which you could replace the dlls etc, and then restart.  Only catch is that you could not use dll functions after you do this, so I would suggest linking Std lib at least statically.
One thing some programs do is copy themselves to a temp area, and run this copy with "--update" or something, which performs the update and then runs the updated version, which then deletes the temp version. Or, always run via a "launcher" program which can do updates before actually starting the app.

Hugh

Jeff Ward

unread,
May 26, 2015, 10:50:53 AM5/26/15
to haxe...@googlegroups.com
Thanks for the suggestions, all.

Hugh - this looks like what I'm interested in. But assuming I know nothing about how to build, link, and load libraries with Haxe, is there a tutorial or simple example showing the basics? I think lime may be dynamically linked from OpenFL (maybe?) but it's too big and complex to grok how the lib stuff works.

Thanks,
-Jeff

der Raab

unread,
May 26, 2015, 12:09:13 PM5/26/15
to haxe...@googlegroups.com
You might look into Adobes update package:

Looks like everything is there and maybe could be ported? It comes with every Flex SDK.

Jeff Ward

unread,
May 27, 2015, 4:59:29 PM5/27/15
to haxe...@googlegroups.com
I'm slowly piecing things together: it looks like you can have a Haxe project target hxcpp as a library (dll, so, etc), perhaps by hand, perhaps using a BuildFile.xml, and the workflow for loading and using these libraries is called FFI (or CFFI? C Foreign Function Interface). You can load (and unload, as Hugh points out) these libraries at runtime, presumably either unload/overwrite/reload or overwrite/restart, to upgrade your application.

Some source links: http://old.haxe.org/doc/cpp/ffi?lang=en http://old.haxe.org/forum/thread/3395#nabble-td6179190 

Of course, this complicates the build (and makes profiling more opaque inside cffi.)

A wrapper application certainly seems a little more straightforward, but I haven't had great luck getting a wrapper application to launch and get out of the way properly on the Windows platform - e.g. I had a splash screen as a separate app, and while it worked on Linux, on Windows the first stayed open until the second was closed (something about forking the process.)

Then again, I suppose a wrapper app complicates the build (and potentially user experience) as well.

Hmm, I'll keep mulling this in the back of my mind.

Lars Doucet

unread,
May 27, 2015, 9:17:28 PM5/27/15
to haxe...@googlegroups.com
I basically replicated the Adobe AIR package update process myself for the original Defender's Quest just using actionscript and my own upgrade path. The user sees this:

- Hey there's a new update, want to get it? Yes / No
- YES: Great, downloading...
- Download complete, let me verify that the signature / checksums etc are correct...
- They are, execute the upgrade? Yes / No
- YES: Great, I'm going to close this app and you'll see an installer open that will replace this app with a new version.
- (Launches the installer, click next and it overwrites the old app)

I assume you want something more like Filezilla's upgrade process that does everything in one magical click?

Jeff Ward

unread,
May 28, 2015, 10:18:52 AM5/28/15
to haxe...@googlegroups.com
I'm just exploring the idea to find out what's possible. It seems like all the lib / ffi complexity only buys me the ability to upgrade without an app restart, but for me a restart isn't a big deal. Your described user flow is probably what I'll end up doing, and if I tuck it in a launcher/splash screen, it could be pretty seamless.

Best,
-Jeff

--
You received this message because you are subscribed to a topic in the Google Groups "Haxe" group.

Tom

unread,
May 30, 2015, 3:30:50 AM5/30/15
to haxe...@googlegroups.com
Hi! I was thought about how to make an elegant way to update a program.
If the program itself is needed to update, then need an updater, which can monitor if the program is running, or can handle that rename/move (to a backup folder) isn't was successful, and wait for it.
If this updater is can seamlessly do this, like a launcher I think it is elegant. (If an installer-only is downloaded and run at every update, I think it is not so elegant, not my way, but faster to do, maybe.)
Just need to download and save files to hdd viaa buffer using http/https transfer. There is a library, which can do this?
If the launcher-updater is smaller is better. And some gui/feedback/progress bar need to display the download how is going.
Can a haxe-app launches a new app in a separate process and quit?

I have more questions that answers, yet. Sorry. :)

Best,
Tom
Reply all
Reply to author
Forward
0 new messages