From 4a3900b0f967f473beace7d74cbb4d10d75b0f59 Mon Sep 17 00:00:00 2001 From: mathieuprog <5883963+mathieuprog@users.noreply.github.com> Date: Tue, 27 Jul 2021 12:12:37 +0200 Subject: [PATCH] Call `:code.priv_dir/1` at runtime --- lib/iana_data_dir.ex | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/iana_data_dir.ex b/lib/iana_data_dir.ex index ee80602..673a442 100644 --- a/lib/iana_data_dir.ex +++ b/lib/iana_data_dir.ex @@ -1,7 +1,8 @@ defmodule Tz.IanaDataDir do @regex_tzdata_dir_name ~r/^tzdata20[0-9]{2}[a-z]$/ + @custom_data_dir Application.get_env(:tz, :data_dir) - defp dir, do: Application.get_env(:tz, :data_dir, :code.priv_dir(:tz)) + defp dir(), do: @custom_data_dir || :code.priv_dir(:tz) def tzdata_dir_name(parent_dir \\ dir()) do tz_data_dirs =