How to get vsn from .app file

Hi, I want to get vsn from build folder after compiling, so I do not add a dep and get from Application module.

For example: (_build/dev/lib/castore/ebin/castore.app)

{application,castore,
             [{applications,[kernel,stdlib,elixir,logger]},
              {description,"Up-to-date CA certificate store."},
              {modules,['Elixir.CAStore']},
              {registered,[]},
              {vsn,"0.1.17"}]}.

What is the best way to get {vsn,"0.1.17"} from top file as a Tuple?

Thank you in advance

1 Like

If you can load it, then Application.load(:castore) and then Application.spec(:castore, :vsn). Otherwise you will have to parse it, which is what we do here: elixir/compile.all.ex at main · elixir-lang/elixir · GitHub

4 Likes

I want to thank you and also mention this point; When the creator of elixir answers a question, the feeling of happiness that follows is indescribable.
Thank you for all your efforts.

4 Likes