Path of the application so that it works on different dev and prod systems?

I want to display an image if it exists (Phoenix 1.7). Right now I have hard coded the path but obviously that is not a working idea. How can I do this so that it works on different dev and prod systems? How can I replace /Users/xyz/GitHub/abc/?

<%= if File.exists?("/Users/xyz/GitHub/abc/priv/static/images/example.jpg") do %>
  <img src={"/images/example.jpg"} alt="xyzzy" />
<% end %>

:code.priv_dir/1

3 Likes

Application.app_dir(:xyz)

Bruh cmon, stop trolling