jpunie
Hello,
While testing the scenic example in combination with Nerves on a RPi3 with a touchscreen, it became clear that the images where not rendering. At first I thought it would be related to the Scenic RPI driver, but this was not the case. Debugging of the path variables resulted in a clear path resolving issue at compile time.
When looking a the default splash.ex the parrot image is loaded as follows:
@parrot_path :code.priv_dir(:scenic_example)
|> Path.join("/static/images/scenic_parrot.png")
@parrot_hash Scenic.Cache.Support.Hash.file!(@parrot_path, :sha)
:code.priv_dir(:scenic_example) will result with a path on my local file system, not on the target.
I had to fix/change this path issue with a config, but maybe this can be done in a more elegant way. My current workaround:
config/config.exs:
config :scenic_example, :priv_dir, "./_build/dev/lib/scenic_example/priv/"
config/rpi3.exs:
config :scenic_example, :priv_dir, "/srv/erlang/lib/scenic_example-0.1.0/priv"
splash.ex:
@parrot_file "/static/images/scenic_parrot.png"
@parrot_path Application.get_env(:scenic_example, :priv_dir)
|> Path.join(@parrot_file)
@parrot_hash_path :code.priv_dir(:scenic_example)
|> Path.join(@parrot_file)
@parrot_hash Scenic.Cache.Support.Hash.file!(@parrot_hash_path, :sha)
The hash has to be calculated at compile time using the file on my local filesystem, hence the double paths.
What would be a more elegant solution to solve this?
Also when the application will be versioned, the path in rpi3.exs has to be changed also, which could be an issue in the future.
Removing the static definitions is always an option, but I think in general the static definitions will work better and easier in the future.
Trending in Questions
Other Trending Topics
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
- #ai
- #ecto-query
- #elixirconf-us
- #blog-post
- #elixir-ls
- #phoenix_html
- #iex
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #elixirconf-eu
- #api
- #forms
- #metaprogramming
- #hex










Showing Posts 1 to 3- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
axelson
Hi @jpunie, indeed that is a known issue/annoyance when working with Scenic, especially when also using Nerves. I wouldn’t worry too much about an elegant way to solve this because Scenic 0.11 is coming soon and how assets work is being re-written, in part because of this specific issue.
Here’s some relevant info:
I believe @boydm is also actively looking for feedback on the assets setup for 0.11, although he may almost be ready to wrap up that portion of work.
jpunie
Hi @axelson,
Great and very valuable feedback. I will look further into the provided info. Also a welcome reminder to keep following the Elixir Slack.
Looking forward to the v0.11 release.
Thank you for all the effort you put into your projects and the support given.
axelson
You’re welcome! And the
#scenicchannel of the elixir slack has really been picking up recently, there was even a remote scenic meetup last month. Also, I feel that I should note that I’m not a maintainer of Scenic, just a happy user. Although I am giving a Scenic-related talk at ElixirConf this year