summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFred Hebert <mononcqc@ferd.ca>2015-08-29 04:55:45 +0000
committerFred Hebert <mononcqc@ferd.ca>2015-08-29 04:55:45 +0000
commit01252ecce4b8019c7d281b672711eee882137dc2 (patch)
tree7bbb20ddbd53b579261ed3bfb85eca0b57c7ad2f
parentbfd40d502b429100bab7980c7a0557b6d573e4ce (diff)
Use raw bytestream when writing files
This patch forces write_file_if_contents_differ/2 to use raw bytes as when writing files. This fixes an issue where UTF-8 characters are processed and written back as ISO-8859-1 into the file, which makes it impossible to use UTF-8 characters in .app.src files.
-rw-r--r--src/rebar_file_utils.erl4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/rebar_file_utils.erl b/src/rebar_file_utils.erl
index 2f39b96..732d83f 100644
--- a/src/rebar_file_utils.erl
+++ b/src/rebar_file_utils.erl
@@ -201,9 +201,9 @@ write_file_if_contents_differ(Filename, Bytes) ->
{ok, ToWrite} ->
ok;
{ok, _} ->
- file:write_file(Filename, ToWrite);
+ file:write_file(Filename, ToWrite, [raw]);
{error, _} ->
- file:write_file(Filename, ToWrite)
+ file:write_file(Filename, ToWrite, [raw])
end.
%% returns an os appropriate tmpdir given a path