1 # Pleroma: A lightweight social networking server
2 # Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>
3 # SPDX-License-Identifier: AGPL-3.0-only
5 defmodule Pleroma.OTPVersion do
6 @spec version() :: String.t() | nil
8 # OTP Version https://erlang.org/doc/system_principles/versions.html#otp-version
10 Path.join(:code.root_dir(), "OTP_VERSION"),
11 Path.join([:code.root_dir(), "releases", :erlang.system_info(:otp_release), "OTP_VERSION"])
13 |> get_version_from_files()
16 @spec get_version_from_files([Path.t()]) :: String.t() | nil
17 def get_version_from_files([]), do: nil
19 def get_version_from_files([path | paths]) do
20 if File.exists?(path) do
23 |> String.replace(~r/\r|\n|\s/, "")
25 get_version_from_files(paths)