Recent

Author Topic: program that downloads and launches another? in a bundle?  (Read 2459 times)

dieselnutjob

  • Full Member
  • ***
  • Posts: 217
program that downloads and launches another? in a bundle?
« on: July 26, 2014, 03:08:22 pm »
I have been playing with a concept whereby a small program (a sort of loader I suppose) can:-

Check if another program exists.
Check for latest md5 on a website.
Compare with the one on disk.
If different delete and download the new one.
Launch it and exit.
I got this working with Windows and Linux but I'm struggling a bit with Mac OSX.

On Windows and Linux the launcher doesn't have a form, but it also works just as well with a form that's hidden.

With MacOSX if I run the programs in a normal directory the second program runs but the user cannot interact with it (you can't click on anything).

If I compile the second program and put it into the bundle it runs and works, but, if I change it's name and put the launcher in there with the second program's original name, then clicking on the 2ndprogram.app icon doesn't run it.

Can you have two executables in a bundle with one that runs the other?  Is there a better way to do this?

thanks, Philip

dieselnutjob

  • Full Member
  • ***
  • Posts: 217
Re: program that downloads and launches another? in a bundle?
« Reply #1 on: July 26, 2014, 07:50:44 pm »
The partial answer to my question is here
http://wiki.freepascal.org/Executing_External_Programs#OS_X_show_application_bundle_in_foreground

However this only shows how to execute a program in another bundle, not how to have two in the same bundle.

I guess that I will have to figure out how to download and unpack a bundle programatically and then I will be able to launch it.

jwdietrich

  • Hero Member
  • *****
  • Posts: 1232
    • formatio reticularis
Re: program that downloads and launches another? in a bundle?
« Reply #2 on: July 28, 2014, 12:52:11 am »
You might use the trick described in http://wiki.freepascal.org/OS_X_Programming_Tips#How_to_obtain_the_path_to_the_Bundle to get the path to your bundle and then proceed as above.
function GetRandomNumber: integer; // xkcd.com
begin
  GetRandomNumber := 4; // chosen by fair dice roll. Guaranteed to be random.
end;

http://www.formatio-reticularis.de

Lazarus 2.2.6 | FPC 3.2.2 | PPC, Intel, ARM | macOS, Windows, Linux

 

TinyPortal © 2005-2018