Elixir Blog Posts

Really cool!!

Accessing priv directory
You probably have some migrations and other stuff inside /priv directory, to access it use Application.app_dir(app, [“priv”]) in your Elixir code and OTP machinery would make sure you won’t loose files inside of it.

Ugh, no!

To get the priv directory always use only :code.priv_dir(:my_app_name)! Though ‘most’ of the time priv will be in the app’s directory, it ‘could’ also be elsewhere, renamed, and variety of other things, and as such this will break in certain situations (like, say, running from inside a tar file or so)… >.>

1 Like