At 17:52 -0700 15/10/07, Chris Nandor wrote:
In article <[EMAIL PROTECTED]>,
 [EMAIL PROTECTED] (David Cantrell) wrote:
 > ie whether it's 10.0, 10.1 etc, I don't care about the difference
 between 10.3.3 and 10.3.4.

This is nice in that it doesn't depend on external processes (sw_vers,
Finder) or files.

   use Mac::Gestalt qw(%Gestalt gestaltSystemVersion);
   (my $version = sprintf("%x", $Gestalt{gestaltSystemVersion()})) =~
      s/^(\d+)(\d)(\d)$/$1.$2.$3/;

Note that gestaltSystemVersion tops out at ".9", so it will return 10.4.9 for all future 10.4 updates (including 10.4.10 and 10.4.11 etc).

Fortunately, this does not affect you.

You can use gestaltSystemVersionMajor, gestaltSystemVersionMinor, and gestaltSystemVersionBugFix to return the three parts of the version (10, 4 and 11).

Enjoy,
   Peter.

--
Keyboard Maestro <http://www.keyboardmaestro.com/> Macros for your Mac
<http://www.stairways.com/>           <http://download.stairways.com/>

Reply via email to