Re: ensure-directories aka create-directories Lassi Kortela 31 Jul 2020 12:10 UTC
> This is mkdir(1) with the -p argument, officially a POSIX standard: > > https://pubs.opengroup.org/onlinepubs/9699919799/utilities/mkdir.html Yes, basically the same thing. > 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. When people write their own ad hoc implementation of it, the following are easy to get wrong: - handling the situation where the given path (or its parents) exist but are not directories. - splitting the pathname correctly when looping through pathname components to create the parents. - giving into the temptation to use the shortcut: (unless (exists? ...) (create ...)) instead of doing it right: (guard (create ...) (... (if EEXIST-or-EISDIR ...)) We could consolidate all additions/changes to the next draft.