diff options
author | Dave Smith <dizzyd@dizzyd.com> | 2009-12-31 19:29:33 -0700 |
---|---|---|
committer | Dave Smith <dizzyd@dizzyd.com> | 2009-12-31 19:29:33 -0700 |
commit | 02fa5f6f42dbeabf324ebc61b049b030a45d30ad (patch) | |
tree | a8747ff696bdf067d2d8b29a255d68791e306eb5 | |
parent | a46be8cec1af5222e4b8c61e3e62ac6be8c4b90e (diff) |
Make sure to reset CWD after processing subdirs; also filter out missing dirs when restoring code path
-rw-r--r-- | src/rebar_core.erl | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/rebar_core.erl b/src/rebar_core.erl index b938b4b..c3ad968 100644 --- a/src/rebar_core.erl +++ b/src/rebar_core.erl @@ -162,8 +162,13 @@ process_dir(Dir, ParentConfig, Commands) -> %% are any other dirs that might need processing first. {UpdatedConfig, Dirs} = acc_modules(select_modules(Modules, preprocess, []), preprocess, Config, ModuleSetFile, []), + ?DEBUG("~s subdirs: ~p\n", [Dir, Dirs]), [process_dir(D, UpdatedConfig, Commands) || D <- Dirs], + %% Make sure the CWD is reset properly; processing subdirs may have caused it + %% to change + ok = file:set_cwd(Dir), + %% Finally, process the current working directory apply_commands(Commands, Modules, UpdatedConfig, ModuleSetFile), @@ -239,7 +244,9 @@ update_code_path(Config) -> restore_code_path(no_change) -> ok; restore_code_path({old, Path}) -> - true = code:set_path(Path), + %% Verify that all of the paths still exist -- some dynamically add paths + %% can get blown away during clean. + true = code:set_path(lists:filter(fun filelib:is_file/1, Path)), ok. |