-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
36 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,25 @@ | ||
defmodule CldrUtils do | ||
@moduledoc false | ||
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters