aboutsummaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorJean-Sébastien Pédron <[email protected]>2019-08-29 15:01:46 +0200
committerJean-Sébastien Pédron <[email protected]>2019-08-29 16:04:51 +0200
commitb0e0c1a4a8b8e32a150af5ac9b94aafaef9fdb8f (patch)
treebc00d8f7c558337e6eaba56c256d436c01e2f2d2 /core
parent40c2b81c64e74add724a01051431abf8fd79fd73 (diff)
downloaderlang.mk-b0e0c1a4a8b8e32a150af5ac9b94aafaef9fdb8f.tar.gz
erlang.mk-b0e0c1a4a8b8e32a150af5ac9b94aafaef9fdb8f.tar.bz2
erlang.mk-b0e0c1a4a8b8e32a150af5ac9b94aafaef9fdb8f.zip
core/erlc.mk: Support non-US-ASCII characters in paths
Internally, strings were stored using Unicode code points. However, when being written to disk with the `file:write_file()` function, there were converted to ISO-8859-1. According to the documentation, that is because the file module is bytewise-oriented: the conversion to another encoding than ISO-8859-1 is the responsibility of the caller. Using unicode:character_to_binary() permits the script to convert the Unicode string to an UTF-8-encoded binary. Without this patch, the added testcase would fail with the following error: gmake[3]: *** No rule to make target '(...)/erlang.mk/test/h��test_core_makedep_non_usascii_paths/deps/test_core_makedep_non_usascii_paths_dep/include/hello.hrl', needed by 'src/hello.erl'. Stop. In this case, the path (passed from the Makefile to the `makedep.erl` script) contains UTF-8-encoded `é` characters but it was converted when doing the final file I/O.
Diffstat (limited to 'core')
-rw-r--r--core/erlc.mk4
1 files changed, 2 insertions, 2 deletions
diff --git a/core/erlc.mk b/core/erlc.mk
index 253aead..d102cd0 100644
--- a/core/erlc.mk
+++ b/core/erlc.mk
@@ -256,11 +256,11 @@ define makedep.erl
string:join(DirSubname ++ [atom_to_list(Target)], "/")
end
end,
- ok = file:write_file("$(1)", [
+ ok = file:write_file("$(1)", unicode:characters_to_binary([
"# Generated by Erlang.mk. Edit at your own risk!\n\n",
[[F, "::", [[" ", D] || D <- Deps], "; @touch \$$@\n"] || {F, Deps} <- Depend],
"\nCOMPILE_FIRST +=", [[" ", TargetPath(CF)] || CF <- CompileFirst], "\n"
- ]),
+ ])),
halt()
endef