aboutsummaryrefslogtreecommitdiffstats
path: root/lib/reltool/src/reltool_utils.erl
diff options
context:
space:
mode:
authorSiri Hansen <[email protected]>2012-03-23 11:48:52 +0100
committerSiri Hansen <[email protected]>2012-03-23 11:48:52 +0100
commitb13b88779b3fbc0ef8bb91a17a5d064cd778e0fa (patch)
tree0f4bce1eb128326affdaacaeb0b2de2ac19860f8 /lib/reltool/src/reltool_utils.erl
parentfd89175a2b17e92a0b90cb28e5af2375d3aa4535 (diff)
parent38f068341ebf04e5d6bf5eff7fb01e44bce228b6 (diff)
downloadotp-b13b88779b3fbc0ef8bb91a17a5d064cd778e0fa.tar.gz
otp-b13b88779b3fbc0ef8bb91a17a5d064cd778e0fa.tar.bz2
otp-b13b88779b3fbc0ef8bb91a17a5d064cd778e0fa.zip
Merge branch 'siri/reltool/app-level-lib-dir/OTP-9977' into maint
* siri/reltool/app-level-lib-dir/OTP-9977: [reltool] Allow lib_dir on app level to use relative path [reltool] Add configuration parameter lib_dir on application level
Diffstat (limited to 'lib/reltool/src/reltool_utils.erl')
-rw-r--r--lib/reltool/src/reltool_utils.erl18
1 files changed, 17 insertions, 1 deletions
diff --git a/lib/reltool/src/reltool_utils.erl b/lib/reltool/src/reltool_utils.erl
index b0def45213..6149d6ef06 100644
--- a/lib/reltool/src/reltool_utils.erl
+++ b/lib/reltool/src/reltool_utils.erl
@@ -22,6 +22,7 @@
-export([root_dir/0, erl_libs/0, lib_dirs/1,
split_app_name/1, prim_consult/1,
default_rels/0, choose_default/3,
+ normalize_dir/1,
assign_image_list/1, get_latest_resize/1, wait_for_stop_motion/2,
mod_conds/0, list_to_mod_cond/1, mod_cond_to_index/1,
@@ -87,6 +88,21 @@ split_app_name(Name) ->
{list_to_atom(Name), ""}
end.
+
+normalize_dir(RelDir) ->
+ Tokens = filename:split(filename:absname(RelDir)),
+ filename:join(lists:reverse(normalize_dir(Tokens, []))).
+
+normalize_dir([".."|Dirs], [_Dir|Path]) ->
+ normalize_dir(Dirs, Path);
+normalize_dir(["."|Dirs], Path) ->
+ normalize_dir(Dirs, Path);
+normalize_dir([Dir|Dirs], Path) ->
+ normalize_dir(Dirs, [Dir|Path]);
+normalize_dir([], Path) ->
+ Path.
+
+
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
prim_consult(Bin) when is_binary(Bin) ->
@@ -256,7 +272,7 @@ app_dir_test(Dir1, Dir2) ->
Name1 > Name2 -> false;
Vsn1 < Vsn2 -> false;
Vsn1 > Vsn2 -> true;
- Parent1 < Parent2 -> true;
+ Parent1 =< Parent2 -> true;
true -> false
end.