aboutsummaryrefslogtreecommitdiffstats
path: root/src/rcl_cmd_args.erl
diff options
context:
space:
mode:
Diffstat (limited to 'src/rcl_cmd_args.erl')
-rw-r--r--src/rcl_cmd_args.erl15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/rcl_cmd_args.erl b/src/rcl_cmd_args.erl
index 3bb9f41..9d829d3 100644
--- a/src/rcl_cmd_args.erl
+++ b/src/rcl_cmd_args.erl
@@ -160,9 +160,22 @@ create_lib_dirs(Opts, Acc) ->
Error = {error, _} ->
Error;
ok ->
- {ok, [{lib_dirs, [filename:absname(Dir) || Dir <- Dirs]} | Acc]}
+ create_root_dir(Opts, [{lib_dirs, [filename:absname(Dir) || Dir <- Dirs]} | Acc])
end.
+-spec create_root_dir([getopt:option()], rcl_state:cmd_args()) ->
+ {ok, rcl_state:cmd_args()} | relcool:error().
+create_root_dir(Opts, Acc) ->
+ Dir = proplists:get_value(root_dir, Opts, undefined),
+ case Dir of
+ undefined ->
+ {ok, Cwd} = file:get_cwd(),
+ {ok, [{root_dir, Cwd} | Acc]};
+ _ ->
+ {ok, [{root_dir, Dir} | Acc]}
+ end.
+
+
-spec check_lib_dirs([string()]) -> ok | relcool:error().
check_lib_dirs([]) ->
ok;