87f70d75a1
for unused API calls. Add a fifo_q_full call to hide the details of that. Alloc work queues along with the async_nif at the end of that memory block. Fix a few places where things should be free'd and were not. Change enqueue to return 0 when shutting down. Fix a race related to shutdown. When I use gdb eunit calls ?cmd() seem to fail, so I've created rmdir:path() to replace ?cmd("rm -rf path") calls.
26 lines
1,008 B
Erlang
26 lines
1,008 B
Erlang
-module(rmdir).
|
|
|
|
-export([path/1]).
|
|
|
|
-include_lib("kernel/include/file.hrl").
|
|
|
|
path(Dir) ->
|
|
remove_all_files(".", [Dir]).
|
|
|
|
remove_all_files(Dir, Files) ->
|
|
lists:foreach(fun(File) ->
|
|
FilePath = filename:join([Dir, File]),
|
|
case file:read_file_info(FilePath) of
|
|
{ok, FileInfo} ->
|
|
case FileInfo#file_info.type of
|
|
directory ->
|
|
{ok, DirFiles} = file:list_dir(FilePath),
|
|
remove_all_files(FilePath, DirFiles),
|
|
file:del_dir(FilePath);
|
|
_ ->
|
|
file:delete(FilePath)
|
|
end;
|
|
{error, _Reason} ->
|
|
ok
|
|
end
|
|
end, Files).
|