anchor.diff:  %%% @doc
   %%%  A group of utility functions for project automation.
   %%% @end
  -%%% @copyright (C) 2007, Erlware
   %%%---------------------------------------------------------------------------
   -module(sin_utils).
   
   -include_lib("kernel/include/file.hrl").
   -include_lib("eunit/include/eunit.hrl").
  -
   -include("internal.hrl").
   
   %% API
   -export([copy_dir/2,
   	 copy_dir/3,
  -         copy_dir/4,
  -	 to_bool/1,
  -         parent_dir/1,
  -         delete_dir/1,
  -         remove_code_paths/1,
  +	 copy_dir/4,
  +	 delete_dir/1,
  +	 file_exists/1,
  +	 find_project_root/1,
   	 get_application_env/1,
  -         is_dir_ignorable/2,
  -         file_exists/1,
  -         find_project_root/1,
  +	 get_ignore_dirs/1,
  +	 is_dir_ignorable/2,
  +	 remove_code_paths/1,
   	 term_to_list/1,
  -	 get_ignore_dirs/1]).
  -
  +	 to_bool/1]).
   
   %%====================================================================
   %% API
   %%====================================================================
  -%%-------------------------------------------------------------------
   %% @doc
   %%  Trivially convert a value to a boolean
  -%%
  -%% @spec (Values) -> true | false
  -%% @end
  -%%-------------------------------------------------------------------
  +%% @end
  +-spec to_bool(any()) -> boolean().
   to_bool(true) ->
       true;
   to_bool("True") ->
  
positive.code:     % Create a directory in /tmp for the test. Clean everything afterwards
      {ok, BaseDir} = ewl_file:create_tmp_dir("/tmp"),
      {setup,
       fun() ->
               ok = file:make_dir(filename:join(BaseDir,"app_name")),
               ok = file:make_dir(filename:join(BaseDir,"ebin")),
               ok = file:make_dir(filename:join(BaseDir,"doc"))
       end,
       fun(_) ->
               ewl_file:delete_dir(BaseDir)
       end,
       fun(_) ->
               TargetDir = filename:join(BaseDir, "app_name"),
               BuildDir =
                   filename:join(TargetDir, "_build/development/apps/app_name"),
  
               {timeout, 2,
                ?_assertThrow(
                   circular_recursion,
                   sin_utils:copy_dir(BuildDir, TargetDir, [], ["."]))}
       end}.
  
negative.code: ignore_dir(_Sub, _Ignorable) ->
      false.
  
  %% @doc
  %%  If any dirs in the list are ignorable ignore it
  %% @end
  -spec are_dirs_ignorable(ListOfDirs::[string()], Igs::[string()]) -> boolean().
  are_dirs_ignorable([Dir | RestOfDirs], Igs) ->
      case is_dir_ignorable(Dir, Igs) of
  	false ->
  	    are_dirs_ignorable(RestOfDirs, Igs);
  	true ->
  	    true
      end;
  are_dirs_ignorable([], _Igs) ->
      false.
  
  %% @doc
  %%   find "_build.cfg" in the current directory. if not recurse
  %%   with parent directory.
  %% @end
  -spec find_project_root(Dir::string()) -> string().
  find_project_root(Start) ->
      ConfigFile1 = filename:join(Start, "_build.cfg"),
      ConfigFile2 = filename:join(Start, "sinan.cfg"),
      case file:read_file_info(ConfigFile1) of
        {ok, _FileInfo} ->
  	    Start;
  	{error, _Reason} ->
  	    case file:read_file_info(ConfigFile2) of
  		{ok, _FileInfo} ->
  		    Start;
  		{error, _Reason} ->
  		    find_project_root(parent_dir(Start))
  	    end
      end.
  
  %% @doc
  %% convert a list body to a string
  %% @end
  -spec listify_list_body(I::term(), Acc::list()) -> list().
  listify_list_body([H | T], []) ->
      listify_list_body(T, term_to_list(H));
  listify_list_body([H | T], Acc) ->
  