From 703a9dae9eb61141da24a1d78addf2ca4126b505 Mon Sep 17 00:00:00 2001 From: Pavel Baturko Date: Fri, 24 Oct 2014 09:46:17 +0400 Subject: [PATCH] deps: fix delete-deps if deps_dir ends with dot Remove possible last dot from deps dir path by calling dirname on base_dir, deps_dir and dummy path part. With this fix delete-deps command deletes dependencies properly in case of deps dir path ended with dot. Examples of deps_dir config value that triggers error: ".", "some/path/.". Code that triggers error: rebar_deps:'delete-deps'/2, code line lists:prefix(DepsDir, D#dep.dir). If deps_dir = ".", cwd = "/root", dependency name = "app" then DepsDir = "/root/." and D#dep.dir = "/root/app" so prefix fun returns false but should be true. Dependency app will not be removed because of this. --- src/rebar_deps.erl | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/rebar_deps.erl b/src/rebar_deps.erl index 24a20c1..a6e5b27 100644 --- a/src/rebar_deps.erl +++ b/src/rebar_deps.erl @@ -307,8 +307,9 @@ get_deps_dir(Config) -> get_deps_dir(Config, App) -> BaseDir = rebar_utils:base_dir(Config), - DepsDir = get_shared_deps_dir(Config, "deps"), - {true, filename:join([BaseDir, DepsDir, App])}. + DepsDir0 = get_shared_deps_dir(Config, "deps"), + DepsDir = filename:dirname(filename:join([BaseDir, DepsDir0, "dummy"])), + {true, filename:join([DepsDir, App])}. dep_dirs(Deps) -> [D#dep.dir || D <- Deps].