Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where to put data for an Erlang release to run

I used rebar to create a release for my Erlang application. My application need to read data from a file. Normally, it is located in the directory where I start erl. But when it comes to release, I don't know where can I put the data so as the application can access it. I tried to put the file in both rel/myrelease/bin and rel/myrelease/release/myverison but the log always show:

{{badmatch,{error,enoent}},

like image 861
user2579326 Avatar asked Oct 01 '16 13:10

user2579326


1 Answers

As explained in the application design principles documentation, normally you put application data into the application's priv directory, and your application code uses the code:priv_dir/1 function to locate its priv directory at runtime in order to find its data files.

like image 180
Steve Vinoski Avatar answered Oct 15 '22 13:10

Steve Vinoski