mirror of
https://github.com/processone/ejabberd.git
synced 2024-12-24 17:29:28 +01:00
Make directory creation more robust
This commit is contained in:
parent
6e63ee480e
commit
e109f352e3
@ -571,16 +571,7 @@ get_dateweek(Date, Lang) ->
|
||||
end).
|
||||
|
||||
make_dir_rec(Dir) ->
|
||||
DirS = binary_to_list(Dir),
|
||||
case file:read_file_info(DirS) of
|
||||
{ok, _} -> ok;
|
||||
{error, enoent} ->
|
||||
DirL = [list_to_binary(F) || F <- filename:split(DirS)],
|
||||
DirR = lists:sublist(DirL, length(DirL) - 1),
|
||||
make_dir_rec(fjoin(DirR)),
|
||||
file:make_dir(DirS),
|
||||
file:change_mode(DirS, 8#00755) % -rwxr-xr-x
|
||||
end.
|
||||
filelib:ensure_dir(<<Dir/binary, $/>>).
|
||||
|
||||
%% {ok, F1}=file:open("valid-xhtml10.png", [read]).
|
||||
%% {ok, F1b}=file:read(F1, 1000000).
|
||||
|
Loading…
Reference in New Issue
Block a user