[plt-scheme] How to set file permissions (chmod) for linux/OSX?

From: Eli Barzilay (eli at barzilay.org)
Date: Fri May 16 10:58:26 EDT 2008

On May 16, Barland, Ian wrote:
> Hi --
> How do I do a `chmod` from within mzscheme, for programs running on
> OSX?

There's no way to change the permissions (yet?).

> (If I need to make an ffi call to 'system', any hints on exactly
> which lib-ffi I need to load?)

That's easy:

  #lang scheme
  (require (lib "foreign.ss")) (unsafe!)
  (define chmod (get-ffi-obj "chmod" #f (_fun _path _int -> _void)))
  (chmod "some-path" #o644)

          ((lambda (x) (x x)) (lambda (x) (x x)))          Eli Barzilay:
                  http://www.barzilay.org/                 Maze is Life!

Posted on the users mailing list.