lib/cldr_utils.ex
defmodule Cldr.Utils do
@moduledoc """
CLDR Utility functions.
"""
@doc """
Returns the current OTP version.
"""
def otp_version do
major = :erlang.system_info(:otp_release) |> List.to_string()
vsn_file = Path.join([:code.root_dir(), "releases", major, "OTP_VERSION"])
try do
{:ok, contents} = File.read(vsn_file)
String.split(contents, "\n", trim: true)
else
[full] -> full
_ -> major
catch
:error, _ -> major
end
end
end