Arc Forumnew | comments | leaders | submitlogin
3 points by pg 5699 days ago | link | parent

I changed date to get the date from Mzscheme, but it's not so easy to change ensure-dir. Mz's make-directory doesn't create intermediate directories like mkdir -p, and I don't want to get into trying to understand pathnames.


2 points by thaddeus 5699 days ago | link

------------------------ In ac.scm

    1. added:
    (require (lib "file.ss"))


    2. added:
    (xdef 'make-directory make-directory)
    (xdef 'make-directory* make-directory*)
------------------------ In arc.arc (got from anarki)

    (def mkdir (path (o parents))
         (if (is parents nil)
             (make-directory path)
             (make-directory* path))
    )

    (def ensure-dir (path)
        (unless (dir-exists path)
             (mkdir path t)))
       
I tested on Windows... (ensure-dir "C:/thaddeus/arc/thaddeus/thaddeus/")

Edited. T.

-----

1 point by eds 5699 days ago | link

Here are the two patches for ensure-dir in Anarki stable:

http://github.com/nex3/arc/commit/111fa3c8f021c4abffc1526c88...

http://github.com/nex3/arc/commit/e4ba31f34f84cd946403541ca8...

According to the comment, there is a bug in MzScheme <371 which sets the sticky bit on *nix, so it may still be necessary to call system sometimes.

-----

1 point by thaddeus 5699 days ago | link

don't forget these changes require mods for the $ usage (which you can probably cut out)

and (xdef 'which-os system-type).

T.

-----

1 point by CatDancer 5699 days ago | link

Oh right, now I remember the sticky bit problem! http://arclanguage.org/item?id=2716

. . . .

-----

1 point by CatDancer 5699 days ago | link

If someone wants to implement this, make-directory* in the file.ss library (http://download.plt-scheme.org/doc/352/html/mzlib/mzlib-Z-H-...) looks like it might do it for you. But I haven't tried it myself (I'm not running Windows either).

-----