Re: [racket-users] Detect version of OS X

2016-02-24 Thread Norman Gray
Jens Axel, hello. On 24 Feb 2016, at 14:04, Jens Axel Søgaard wrote: What happens if /Library/Tex/texbin is present - but not in the path? A good point. Using Matthew's reminder of the existence of find-executable-path (which I've used before, but was too focused on "system" here), how

Re: [racket-users] Detect version of OS X

2016-02-24 Thread Jens Axel Søgaard
What happens if /Library/Tex/texbin is present - but not in the path? /Jens Axel 2016-02-24 14:34 GMT+01:00 Stephen De Gabrielle : > Thank you - very good advice - I'll have to change my pull request. > S. > > On Wed, 24 Feb 2016 at 10:57, Norman Gray

Re: [racket-users] Detect version of OS X

2016-02-24 Thread Matthew Flatt
I recommend `find-executable-path` instead of `system` plus "which". At Wed, 24 Feb 2016 13:34:19 +, Stephen De Gabrielle wrote: > Thank you - very good advice - I'll have to change my pull request. > S. > On Wed, 24 Feb 2016 at 10:57, Norman Gray wrote: > > > > >

Re: [racket-users] Detect version of OS X

2016-02-24 Thread Stephen De Gabrielle
Thank you - very good advice - I'll have to change my pull request. S. On Wed, 24 Feb 2016 at 10:57, Norman Gray wrote: > > Greetings > > On 23 Feb 2016, at 20:46, Jens Axel Søgaard wrote: > > > Use case: The paths to LaTeX has changed on El Capitan, > > which makes it

Re: [racket-users] Detect version of OS X

2016-02-24 Thread Norman Gray
Greetings On 23 Feb 2016, at 20:46, Jens Axel Søgaard wrote: Use case: The paths to LaTeX has changed on El Capitan, which makes it difficult to choose a default path, that works for all. Addressing that particular use-case (following the motto that one should test the functionality rather

Re: [racket-users] Detect version of OS X

2016-02-23 Thread Stephen De Gabrielle
what about this? #lang racket/base (require racket/system racket/port) (substring (with-output-to-string (lambda () (system "sw_vers -productVersion"))) 3 5) I get "10" or "11" respectively, and I believe it will run on older versions OS X. s. On Tue, Feb 23, 2016 at 9:38 PM Jens

Re: [racket-users] Detect version of OS X

2016-02-23 Thread Jens Axel Søgaard
The system-type approach looks like this (it ignores the optional third version counter): (match (regexp-match #px".*Kernel Version ([\\d]+[.][\\d]+).*" (system-type 'machine)) [(list _ version-str) (string->number version-str)] [_ #f]) The expression returns 15.0 on my machine.

Re: [racket-users] Detect version of OS X

2016-02-23 Thread Matthew Flatt
You could parse the result of `(system-type 'machine)`, but you might just as well use a little `ffi/unsafe` binding to get `NSAppKitVersionNumber`: #lang racket/base (require ffi/unsafe) (define appkit (ffi-lib "/System/Library/Frameworks/AppKit.framework/AppKit")) (define

[racket-users] Detect version of OS X

2016-02-23 Thread Jens Axel Søgaard
Hi All, The function system-type can be used to detect the system type. Is there a function that returns the version of the operating system? Use case: The paths to LaTeX has changed on El Capitan, which makes it difficult to choose a default path, that works for all. /Jens Axel -- You