anchor.diff:  sha1_round(FD, {ok, Data}, Ctx) ->
       sha1_round(FD, file:read(FD, 1024*1024), crypto:sha_update(Ctx, Data)).
   
  +
  +
  +del_dir_r(DirName) ->
  +    {ok, SubFiles} = file:list_dir(DirName),
  +    [file:delete(X) || X <- SubFiles],
  +    del_dir(DirName).
  +
  +del_dir(DirName) ->
  +    io:format(user, "Try to delete directory ~p.~n", [DirName]),
  +    case file:del_dir(DirName) of
  +        {error,eexist} ->
  +            io:format(user, "Directory is not empty. Content: ~n~p~n", 
  +                      [element(2, file:list_dir(DirName))]),
  +            ok;
  +        ok ->
  +            ok
  +    end.
  
positive.code:     ok.
  
  end_locations(Config) ->
      DataDir = ?config(data_dir, Config),
      PrivDir = ?config(priv_dir, Config),
  
      %% Remove locations
      %% 
      ok = file:delete(filename:join([PrivDir, ?ET_WORK_DIR, ?TESTFILE30M])),
      ok = file:del_dir(filename:join([PrivDir, ?ET_WORK_DIR])),
  
      io:format(user, "WTF: ~p~n", 
                [file:list_dir(filename:join([PrivDir, ?TR_WORK_DIR]))]),
      ok = file:delete(filename:join([PrivDir, ?TR_WORK_DIR, "settings.json"])),
      ok = file:del_dir(filename:join([PrivDir, ?TR_WORK_DIR])).
  
  
  init_locations(Config) ->
      %% Setup locations that some of the test cases use
      DataDir = ?config(data_dir, Config),
      PrivDir = ?config(priv_dir, Config),
  
negative.code: 			Port = open_port(
  				 {spawn, Spawn},
  				 [stream, binary, eof]),
              transmission_loop(Port, Ref, Self, <<>>, <<>>)
  		     end),
      {Ref, Pid}.
  
  stop_transmission(Config, Pid) when is_pid(Pid) ->
      io:format(user, "Stop transmission~n", []),
      Pid ! close,
      end_transmission_locations(Config),
      ok.
  
  end_transmission_locations(Config) ->
      io:format(user, "Cleaning transmission directory.", []),
      PrivDir = ?config(priv_dir, Config),
  
      %% Transmission dir needs some help:
      ok = del_dir_r(filename:join([PrivDir, ?TR_WORK_DIR, "resume"])),
      ok = del_dir_r(filename:join([PrivDir, ?TR_WORK_DIR, "torrents"])),
      ok = del_dir_r(filename:join([PrivDir, ?TR_WORK_DIR, "blocklists"])),
      ok.
  
  
  stop_leecher(Config) ->
      ok = rpc:call(?config(leech_node, Config), etorrent, stop_app, []),
  