I am reading and writing some files using
File.write!("tmp/random_file_name.txt") and File.read!("tmp/random_file_name.txt") from various points in my application, but they seem to randomly end up in, or being read from, the
tmp folder in the umbrella root, or in the
apps/my_app/tmp. There is no consistency in the behaviour on a per-module basis per instance. It seems that the current working directory is not always the directory that the app is started from.
The app is an umbrella app that contains a Phoenix project. It was migrated from a regular app into an umbrella, so maybe I’m missing some configuration. This is the project section of my app’s Mixfile:
def project do [app: :my_app, version: "0.0.1", elixir: "~> 1.5.0", elixirc_paths: elixirc_paths(Mix.env), compilers: [:phoenix, :gettext] ++ Mix.compilers, build_embedded: Mix.env == :prod, start_permanent: Mix.env == :prod, aliases: aliases(), deps: deps(), build_path: "../../_build", deps_path: "../../deps", config_path: "../../config/config.exs", lockfile: "../../mix.lock", preferred_cli_env: [ vcr: :test, "vcr.delete": :test, "vcr.check": :test, "vcr.show": :test ] ] end
This is the project section of the umbrella’s Mixfile:
def project do [apps_path: "apps", build_embedded: Mix.env == :prod, start_permanent: Mix.env == :prod, deps: deps(), dialyzer: [ignore_warnings: ".dialyzer/ignore-warnings"], build_path: "_build", deps_path: "deps"] end
Any idea what might be going on here?