diff options
author | Siri Hansen <[email protected]> | 2012-09-12 10:12:55 +0200 |
---|---|---|
committer | Siri Hansen <[email protected]> | 2012-09-12 10:12:55 +0200 |
commit | 8d74edab223477c704af62b19793f0f8282fc749 (patch) | |
tree | e050d38b8b7cc76434b9363f2289703f2e6ac8c6 /lib | |
parent | 6f3205aed3acfb0a8426e87bfe52d6a36bceeb08 (diff) | |
download | otp-8d74edab223477c704af62b19793f0f8282fc749.tar.gz otp-8d74edab223477c704af62b19793f0f8282fc749.tar.bz2 otp-8d74edab223477c704af62b19793f0f8282fc749.zip |
[reltool] Make reltool:install/2 work on windows
The erl.ini file generated by reltool:install/2 faulty pointed out
$ROOT/bin as Bindir. This is now changed to $ROOT/erts-Vsn/bin. Also,
backslashes in erl.ini needed to be escaped.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/reltool/src/reltool_target.erl | 17 | ||||
-rw-r--r-- | lib/reltool/test/reltool_server_SUITE.erl | 5 |
2 files changed, 13 insertions, 9 deletions
diff --git a/lib/reltool/src/reltool_target.erl b/lib/reltool/src/reltool_target.erl index c39ed0ecd5..8296cd95be 100644 --- a/lib/reltool/src/reltool_target.erl +++ b/lib/reltool/src/reltool_target.erl @@ -1420,12 +1420,10 @@ do_install(RelName, TargetDir) -> BinDir = filename:join([TargetDir2, "bin"]), case os:type() of {win32, _} -> - NativeRootDir = filename:nativename(TargetDir2), - %% NativeBinDir = - %% filename:nativename(filename:join([BinDir, "win32"])), - NativeBinDir = filename:nativename(BinDir), + NativeRootDir = nativename(TargetDir2), + NativeErtsBinDir = nativename(ErtsBinDir), IniData = ["[erlang]\r\n", - "Bindir=", NativeBinDir, "\r\n", + "Bindir=", NativeErtsBinDir, "\r\n", "Progname=erl\r\n", "Rootdir=", NativeRootDir, "\r\n"], IniFile = filename:join([BinDir, "erl.ini"]), @@ -1445,6 +1443,15 @@ do_install(RelName, TargetDir) -> reltool_utils:throw_error("~s: Illegal data file syntax", [DataFile]) end. +nativename(Dir) -> + escape_backslash(filename:nativename(Dir)). +escape_backslash([$\\|T]) -> + [$\\,$\\|escape_backslash(T)]; +escape_backslash([H|T]) -> + [H|escape_backslash(T)]; +escape_backslash([]) -> + []. + subst_src_scripts(Scripts, SrcDir, DestDir, Vars, Opts) -> Fun = fun(Script) -> subst_src_script(Script, SrcDir, DestDir, Vars, Opts) diff --git a/lib/reltool/test/reltool_server_SUITE.erl b/lib/reltool/test/reltool_server_SUITE.erl index 36d26bec68..4c1b7a6756 100644 --- a/lib/reltool/test/reltool_server_SUITE.erl +++ b/lib/reltool/test/reltool_server_SUITE.erl @@ -952,8 +952,6 @@ create_multiple_standalone(Config) -> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% Generate old type of target system - -create_old_target(_Config) -> {skip, "Old style of target"}; create_old_target(_Config) -> %% Configure the server @@ -976,8 +974,7 @@ create_old_target(_Config) -> ?m(ok, reltool_utils:recursive_delete(TargetDir)), ?m(ok, file:make_dir(TargetDir)), ok = ?m(ok, reltool:create_target([{config, Config}], TargetDir)), - - %% io:format("Will fail on Windows (should patch erl.ini)\n", []), + ok = ?m(ok, reltool:install(RelName2, TargetDir)), Erl = filename:join([TargetDir, "bin", "erl"]), |