   @spec app_dir(app, String.t() | [String.t()]) :: String.t()
   def app_dir(app, path)
 
-  def app_dir(app, path) when is_binary(path) do
+  def app_dir(app, path) when is_atom(app) and is_binary(path) do
     Path.join(app_dir(app), path)
   end
 
-  def app_dir(app, path) when is_list(path) do
+  def app_dir(app, path) when is_atom(app) and is_list(path) do
     Path.join([app_dir(app) | path])
   end
 

  `fetch_env/2`. Returns `nil` if the application is not loaded.
  """
  @spec spec(app) :: [{key, value}] | nil
  def spec(app) do
    case :application.get_all_key(app) do
      {:ok, info} -> :lists.keydelete(:env, 1, info)
      :undefined -> nil

  Returns all key-value pairs for `app`.
  """
  @spec get_all_env(app) :: [{key, value}]
  def get_all_env(app) when is_atom(app) do
    :application.get_all_env(app)
  end

