aboutsummaryrefslogtreecommitdiffstats
path: root/lib/sasl/src/systools_lib.erl
diff options
context:
space:
mode:
authorSiri Hansen <[email protected]>2013-02-21 09:45:22 +0100
committerSiri Hansen <[email protected]>2013-02-22 09:52:45 +0100
commit8bd8592659430a1fa2243a16ae9b6d6a7c14ba97 (patch)
treeec1f21e7e8a3603453256d42581b188ef2e8bb5f /lib/sasl/src/systools_lib.erl
parent565b4a4065229c0c9ea08a758be3a2c228514883 (diff)
downloadotp-8bd8592659430a1fa2243a16ae9b6d6a7c14ba97.tar.gz
otp-8bd8592659430a1fa2243a16ae9b6d6a7c14ba97.tar.bz2
otp-8bd8592659430a1fa2243a16ae9b6d6a7c14ba97.zip
[sasl] Adapt release handling mechanisms to unicode
* Update systool_lib:read_term/1 to honour magic encoding comment in file. * Add unicode option to re:compile and re:run when appropriate, allowing e.g. unicode filenames. * systools_make to allow unicode strings in .rel and .app files
Diffstat (limited to 'lib/sasl/src/systools_lib.erl')
-rw-r--r--lib/sasl/src/systools_lib.erl15
1 files changed, 10 insertions, 5 deletions
diff --git a/lib/sasl/src/systools_lib.erl b/lib/sasl/src/systools_lib.erl
index 1b6ea125d9..6618baa2aa 100644
--- a/lib/sasl/src/systools_lib.erl
+++ b/lib/sasl/src/systools_lib.erl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 1996-2011. All Rights Reserved.
+%% Copyright Ericsson AB 1996-2013. All Rights Reserved.
%%
%% The contents of this file are subject to the Erlang Public License,
%% Version 1.1, (the "License"); you may not use this file except in
@@ -42,7 +42,11 @@ file_term2binary(FileIn, FileOut) ->
%%______________________________________________________________________
%% read_term(File) -> {ok, Term} | Error
-
+%%
+%% This is really an own implementation of file:consult/1, except it
+%% returns one term and not a list of terms. Keeping the function
+%% instead of using file:consult - for backwards compatibility with
+%% error reasons.
read_term(File) ->
case file:open(File, [read]) of
{ok, Stream} ->
@@ -54,6 +58,7 @@ read_term(File) ->
end.
read_term_from_stream(Stream, File) ->
+ _ = epp:set_encoding(Stream),
R = io:request(Stream, {get_until,'',erl_scan,tokens,[1]}),
case R of
{ok,Toks,_EndLine} ->
@@ -176,11 +181,11 @@ add_dirs(RegName, Dirs, Root) ->
regexp_match(RegName, D0, Root) ->
case file:list_dir(D0) of
{ok, Files} when length(Files) > 0 ->
- case re:compile(RegName) of
+ case re:compile(RegName,[unicode]) of
{ok, MP} ->
FR = fun(F) ->
- case re:run(F, MP) of
- {match,[{0,N}]} when N == length(F) ->
+ case re:run(F, MP, [{capture,first,list}]) of
+ {match,[F]} -> % All of F matches
DirF = join(D0, F, Root),
case dir_p(DirF) of
true ->