Skip to content

Commit

Permalink
Don't overwrite existing charset file
Browse files Browse the repository at this point in the history
Needlessly overwriting the charset file in the src folder triggers
infinite recompilation in Elixir LS.

Signed-off-by: Karolis Petrauskas <[email protected]>
  • Loading branch information
kape1395 authored and vinoski committed Nov 25, 2024
1 parent 0c8ed0e commit 8cc16cb
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions rebar.config.script
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,19 @@ ErtsVsn = case string:tokens(erlang:system_info(version), ".") of
end.

%% generate a charset include file
ok = file:write_file(filename:join(Dir, "src/yaws_charset.hrl"),
case os:getenv("YAWS_CHARSET") of
YawsCharsetFile = filename:join(Dir, "src/yaws_charset.hrl"),
YawsCharsetContent = case os:getenv("YAWS_CHARSET") of
false ->
<<"-define(YAWS_CHARSET, undefined).\n">>;
Charset ->
[<<"-define(YAWS_CHARSET, \"">>,
Charset, <<"\").\n">>]
end),
erlang:iolist_to_binary([<<"-define(YAWS_CHARSET, \"">>,
Charset, <<"\").\n">>])
end,
ok = case file:read_file(YawsCharsetFile) of
{ok, YawsCharsetContent} -> ok;
{ok, _} -> file:write_file(YawsCharsetFile, YawsCharsetContent);
{error, _} -> file:write_file(YawsCharsetFile, YawsCharsetContent)
end,

SoapDeps = [{erlsom, ".*", {git, "git://github.com/willemdj/erlsom.git", {tag, "1.4.0"}}},
{xmlrpc, ".*", {git, "git://github.com/rwbr/exmlrpc.git",
Expand Down

0 comments on commit 8cc16cb

Please sign in to comment.