Re: ensure-directories aka create-directories hga@xxxxxx (31 Jul 2020 12:03 UTC)
Re: ensure-directories aka create-directories Shiro Kawai (31 Jul 2020 12:15 UTC)

Re: ensure-directories aka create-directories hga@xxxxxx 31 Jul 2020 12:03 UTC

This is mkdir(1) with the -p argument, officially a POSIX standard:

https://pubs.opengroup.org/onlinepubs/9699919799/utilities/mkdir.html

And I agree, it's a really useful thing.  It would not be super
expensive to add to srfi-170.html, and the Chibi Scheme sample
implementation.  The former has undergone enough changes (two APIs
dropped) that I assume another draft will need to be published.

- Harold

----- Original message -----
From: Lassi Kortela <xxxxxx@lassi.io>
Date: Friday, July 31, 2020 5:46 AM

SRFI 170 is missing one of the most useful (and commonly missing, and
tricky/error-prone to manually implement) OS procedures:

(ensure-directory "foo")

* Create directory "foo" while also creating any missing parent directories.

* If "foo" already exists and is a directory, silently succeed.

* If "foo" (or one of its parents) already exists but is not a
directory, raise an exception.

* On file system error, raise an exception as usual.