[erlang-patches] [RFC PATCH] Ignore {error,eexist} in filelib:ensure_dir/1

Björn Gustavsson <>
Sun Jan 17 17:01:59 CET 2010

On Fri, Jan 15, 2010 at 5:59 PM, Tuncer Ayaz <> wrote:
> git fetch git://github.com/tuncer/otp.git ensure_dir_eexist
> --
> I couldn't completely agree on the indenting of nested cases
> based on the rest of filelib.erl so please let me know if
> this is not compliant :).

We use 8-step tabs and indent 4 steps using
a mixture of TABs and spaces. (As done automatically
by the Erlang mode in Emacs.)

I have fixed the indentation and included your patch in 'pu'.

However, one problem with the patch is that
if there already is a file with the same directory
that you are trying to create, 'ok' will be returned.

One way to fix the problem would be change
to unconditionally attempt to create each directory.
If creation fails with eexist, it should be tested
whether there already is a directory. If yes,
return 'ok', otherwise return {error,eexist}.

Björn Gustavsson, Erlang/OTP, Ericsson AB

More information about the erlang-patches mailing list