smon
Hi everyone,
I was thinking of resources like images, XML files or documents in other text formats. Is there something similar to the resources folder in Java (“src/main/resources”)? The goal would be to add files to my package that can be accessed from code on runtime.
Or is this somehow a very un-Elixir-y way of thinking? Elixir is my first functional language - so what would be the “right” way to do it?
Cheers,
smon
Trending in Questions
I’m working on a project that simulates the bumbl example in the programming phoenix book. It acts almost like an email client. We have a...
New
I’m seeing that a list inside a Kino.DataTable will be interpreted as a charlist, even if the Kino.configure() is set to charlists: :as_l...
New
So my question is quite simple and i have found no conclusive answer on forum, google or AI.
Should we use :erlang.float for Integer to ...
New
Hello,
I know there is an approach for handling lists that allows for optimized traversal, but I can’t recall the specific method (somet...
New
Hi, I’ve just set up an application with ash_authentication. There is only magic link strategy for now, so there is no confirmation add o...
New
If a change or preparation module uses Ash.Changeset.get_argument/2 or Ash.Query.get_argument/2 (or any of the other get_argument functio...
New
apply_graft/2 doesn’t rewrite an add_many sub-workflow’s deps on an add step. Grafted jobs cancel with “upstream job was deleted”
Version...
New
Other Trending Topics
I am happy to introduce the very α version of the new programming language compiled to BEAM.
Welcome Cure.
It has literally three kille...
New
Hi there! We created Gust: A task orchestrator inspired by Airflow.
For those who have never heard about Aiflow, it’s a Python-based wor...
New
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
Xamal is a deployment tool for Elixir apps that deploys native releases to bare metal servers over SSH. It’s a port of GitHub - basecamp/...
New
Hello everyone. After busy few months I am happy to announce v0.1.0 of Emerge & Solve.
They are GUI (Emerge) and State management (S...
New
Corex is an accessible, unstyled UI component library for Phoenix that integrates Zag.js state machines using Vanilla JavaScript and Live...
New
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #library
- #deployment
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #elixirconf
- #channels
- #exunit
- #discussion
- #code-sync
- #podcasts
- #javascript
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixirconf-us
- #ai
- #blog-post
- #elixir-ls
- #phoenix_html
- #iex
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #hex
- #security
- #metaprogramming










Showing Posts 1 to 10- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
benwilson512
Hey!
That is precisely what the
/privfolder is for in your project root. It’ll get packaged up along with your application when you build a release. If you have adata.xmlfile in your/privdirectory you can get to it in your code by doingsmon
Awesome!
Thank you very much.
privis an abbreviation of what exactly? “private”? Or am I missing some more obvious term it stands for?Cheers,
smon
david
Erlang OTP Design Principles User’s Guide at Directory Structure
Per Jose:
Elixir Lang Talk - What is Priv?
smon
I am unable to open a
File.stream!for the file in my/privfolder when running my escript-build. Do I have to fallback to Erlang? Using a path generated the way you described only works when starting the application iniex.Edit
From the Mix.Tasks.Escript.Build:
Damn…
benwilson512
I have it on good authority that http://elixir-lang.org/docs/master/elixir/Application.html#app_dir/1 is an option here.
benwilson512
Edited my previous reply in light of new information.
smon
I am not quite sure if I understood correctly.
produced the path
/path/to/my_app/my_app/priv/data.xml, where the firstmy_appcorresponds the escript build file.By replacing
:code.priv_dir(:my_app)withapp_dir(:my_app), I can get rid off theprivsub-folder, but that still does not allow me to open a valid file stream.sentient-wendy
Hi @smon and @benwilson512, I’d also like to know if there are options to access the /priv folder for a command line utility built with escript. Please update if you’ve found anything. Thank you in advance!
smon
Hey!
Sorry I did not check the forum for quite some time. The answer seems to be the thing I already mentioned:
I basically gave up on the idea of adding the file to the build file.
josevalim
To confirm: although priv is the appropriate place, we can’t load files from
privinside escripts. What I usually do is to load the file at compilation time and store it as a module attribute: