Hi everybody,
I wanted to know if it’s possible to configure the cwd (current working directory) path of the mix.exs
file (which is the root path of the application) for iex
.
Let me precise that I don’t want to change the defaults (i.e. move the mix.exs
file elsewehre).
But I’m in a situation where I’m invoking mix commands from a directory that it’s not the project root.
For the details, I’m using VS Code tasks shortcuts to run mix commands where the cwd is the workspace directory of VS Code. So the mix commands fail because of not being in the same directory of the mix.exs
file (error: Could not find a Mix.Project)
So, in other words I want to be able to run mix commands from another directory than the project root and be able to tell mix
or iex
(in case of iex -S mix
) where to look for the mix.exs
file.
I learned that IEx is looking for a dot file .iex.exs
(in the cwd or in home) which it runs before starting the IEx session.
So I wonder if there is something equivalent for mix commands (where I can into the project root path) ?
Or if there is a way to define some kind of options in .iex.exs
to define the path where mix
should look for and then running iex -S mix
?
I currently have found a workaround by either by cd
ing before running the mix command (like cd project_dir && mix test
) or by defining in VS Code the cwd
of the task to run.
But I wanted to know if it’s possible to configure that inside the elixir project.
Thank you.