afm-util run not running my application #automotive #help


Vele Tosevski
 

Hey guys,

I am trying to run an application that I have installed.  In my application, there is an init function that takes a path to a config file relative to the application root directory. 
When I run the application with afb-daemon and --workdir set, it runs since the work directory function points afb-daemon to the application root directory and thus, the file is found.
If I run afb-daemon without workdir set (meaning that it just takes on the value of pwd), it does not run, giving a File Not Found -100 error for my config file.
I am assuming that afm-util uses an absolute path to an application directory.  For some reason though, it does not let my application find my config file.  

A few solutions I have brainstormed:
1. I can always change my relative path in my application to an absolute path to my config file. However, I do not want to do this for obvious reasons.
2. I can add to my path in my application some sort of environment variable that afm-util uses across the board for mapping to the AGL application directory.  However, I am not sure if such a variable exists. 

Any help would be appreciated!

Thanks,
Vele


Jose Bollo
 

Hello Vele,

Applications have to manage 2 directories:
- the root directories is intended to be like read only and contains
the installed files
- the working directory where living application put its read write
data

afb-daemon provides the environment variable AFB_ROOTDIR to retrieve
the first one.

Hope it helps
Best regards
José Bollo

On Thu, 29 Oct 2020 09:39:36 -0700
"Vele Tosevski" <vele@...> wrote:

Hey guys,

I am trying to run an application that I have installed.  In my
application, there is an init function that takes a path to a config
file *relative to the application root directory.* When I run the
application with afb-daemon and --workdir set, it runs since the work
directory function points afb-daemon to the application root
directory and thus, the file is found. If I run afb-daemon without
workdir set (meaning that it just takes on the value of pwd), it does
not run, giving a File Not Found -100 error for my config file. I am
assuming that afm-util uses an absolute path to an application
directory.  For some reason though, it does not let my application
find my config file.

A few solutions I have brainstormed:
1. I can always change my relative path in my application to an
absolute path to my config file. However, I do not want to do this
for obvious reasons. 2. I can add to my path in my application some
sort of environment variable that afm-util uses across the board for
mapping to the AGL application directory.  However, I am not sure if
such a variable exists.

Any help would be appreciated!

Thanks,
Vele





Vele Tosevski
 

Thanks Jose!

I was wondering, where does "afm-util run" set the root-dir as?  The problem with my program is that the path I need to set is given as a relative path to another library included in my project that takes the absolute path of the current working directory and appends whatever I give it.  So I can't even give it the absolute path!   

I need to know where afm-util's working directory is.

Thanks, 
Vele


Jose Bollo
 

On Fri, 30 Oct 2020 12:16:37 -0700
"Vele Tosevski" <vele@...> wrote:

Thanks Jose!

I was wondering, where does "afm-util run" set the root-dir as?  The
problem with my program is that the path I need to set is given as a
relative path to another library included in my project that takes
the absolute path of the current working directory and appends
whatever I give it.  So I can't even give it the absolute path!

I need to know where afm-util's working directory is.
Hello Vele,

For the working directory, the binder also set the environment variable
AFB_WORKDIR to the meaningful value.

About your case, reading you, I still have difficulties to figure me
what you expect. My best guess is that you have to give the relative
path of something in the ROOTDIR while being in the WORKDIR. In that
case you probably need the 2 paths to compute some relative thing. An
other solution is to (temporarily or not) change the working directory.

I still have not answered the question anyway. The paths are defined in
the systemd service generated to launch your application. Its location
is in /var/local/lib/systemd/system.

Best regards
José Bollo


Thanks,
Vele