#How to organize data files in a library?

5 messages · Page 1 of 1 (latest)

remote ginkgo
#

I'm just coming back to Elixir after a break, and for some reason the answer to this is eluding me: Is there a convention for organizing and accessing data files in an elixir project? For example if I'm writing a library that includes a blob of data in something like geo-data.json, where should that file live in the project, and how should I get a path to that file so I can load it dependably with File.open() when the library is included as a dependency in some program?

terse sinew
#

About non-code data the main location for them is priv directory

#

But if it is used only at compile-time, then it doesn't really matter

#

When it is used in runtime, then priv is the way to go

#

Then you can get path for your priv via :code.priv_dir(:my_app)