On 2015-11-29 03:30, Mike McKee wrote:

I'm coding an antivirus application for the Mac, using a third-party
antivirus engine, in Qt/C++. It needs some things to run under high
privileges. As far as I know, you can't do that with a DMG package, but
can do it with a PKG package.

You can do that from inside your application. For example, Xcode has a separate preference pane to download the iOS simulator of various versions, same thing for the documentation.

TextMate and GitX has a menu that allow you to install the command line tools for the application.

I've learned a tremendous amount about PKG packages (the docs are
difficult), but the one thing that doesn't seem possible is to download
a component from a remote URL with it except via a Perl or Bash script.
The PKG flat format supports a way to call a preinstall and postinstall
Perl or Bash script. The trouble with that technique, however, is that
if you have a 30MB download that takes awhile, the installer screen sits
at "Running Package Scripts..." for like 3 minutes (on 2Mbps DSL) and
this can confuse the consumer into thinking the installer is hung up,
when it isn't.

Why can't you bundle everything in the PKG package? What's the advantage of first downloading a small binary/package which then downloads the real application?

The thing I'd like to achieve with D is to have my Bash or Perl script
call a command line D application that finds the current installer
window x,y, hides the Cocoa-based window, draws my new Cocoa-based
window to replace it at the same x,y,w,h as the other one, and then runs
curl command to download the file, then uses the D application again to
stop showing my custom window, unhide the installer window, and exit the
Bash script.

If you really go that route (still don't see why this would be necessary) I guess DerelictCocoa is the way to go [1], or even better use the new Objective-C support that D got in the latest version of DMD [2].

So, some things I need to learn in D:

* How to enumerate the currently visible Cocoa windows and their titles
or internal names, along with their window handle.

* How to get the x,y of an existing Cocoa window by its window handle.

* How to hide a Cocoa window by its window handle.

* How to draw my own Cocoa window at an x,y coordinate.

* How to destroy my Cocoa window by its window handle.

* How to unhide a previously hidden Cocoa window by its window handle.

These are not specific for D. You can search for how to do this in Objective-C/Swift and then figure out how to translate the code to D.

[1] https://github.com/p0nce/DerelictCocoa/tree/master/examples/window
[2] http://dlang.org/spec/objc_interface.html

--
/Jacob Carlborg

Reply via email to