You should use the real name of your application, not just appname, unless the name of your application is appname. So, if the name of your application is someApp the code should be something like
Lets imagine for a minute that i am not a complete idiot and i actually used my real app name (app name is irrelevant to the question) and it still doesn’t work.
What else should i try?
Is it some kind of reserved name? Otherwise i don’t understand what should i put there and how it should help.
Sorry i can’t test it right now, problems with my linux machine.
If your application is non-sandboxed, then your original procedure should work, afaik.
In case of sandboxed application, for each application there is its own config tree and you should grant your application access to to those trees. version information is located in system tree, so you should grant access to the system tree.
requires:
{
configTree:
{
[w] . // I need write access to my configuration data.
[r] system // I need read access to system configuration data.
}
}
But that’s not all. If you’re accessing another tree, you should specify the name of this tree in path argument. So, it should look something like:
Is there another way to do this? It’s been a while… so hoping.
The manuals specifically say to NOT grant access to system, for security reasons; but then tell us that’s the only way for an application to know its own version. It’s an important piece of trivia… so… hoping there’s a cleaner way.
root@swi-mdm9x28-wp:~# app version wifi
wifi 19.02.0.rc3
root@swi-mdm9x28-wp:~# app version atServerIntegrationTest
atServerIntegrationTest has no version
Have you referred to the code here for “app version”?
BTW, will you consider an easier way to create an unsandboxed application to handle this “app version” and then your sandboxed application can communicate with it via IPC?
The appCtrl code uses same technique: read the system:/apps config tree. So I suppose… that’s how it’s done.
Needing to expose system: just to include a version number in help-about response text… seems there should be a better way. The appinfo API returns a HASH of the version number, but not the version number itself… unsure where that decision came from.
will you consider an easier way to create an unsandboxed application to handle this “app version” and then your sandboxed application can communicate with it via IPC?
IPC plus another application. Might be easier. Perhaps not.
Using “make”, I can achieve the goal without that.
To make the application version available to both Legato and the application itself, I did the following.
I removed the version from ADEF, and put it into a one-line “app.version” file
mkapp then adds it back when building (using the -a parameter)
make also creates an app.version.h file… which will be compiled into the code
OR
use a -D compile option to add the #define statement using pre-processing
This way, the version number is available to both Legato and my application code. They get the information from different sources, but the answer will be consistent.
I’m a “make” newbie… but here’s my Makefile change. (Listening eagerly for a better alternative.)