How to read "Machine configuration directory" in HAL userspace component

More
23 Nov 2022 12:17 #257457 by dgarrett
> I'm all in Qt and/or c++; No No No Python; what so ever;

for environmental variables like INI_FILE_NAME:

$ man -s3 getenv

Please Log in or Create an account to join the conversation.

More
23 Nov 2022 13:23 #257468 by udoS
@dgarrett
there is no  "INI_FILE_NAME" or "CONFIG_DIR" in the env; Sorry.

About that stat() ? 

Please Log in or Create an account to join the conversation.

More
23 Nov 2022 14:14 #257474 by dgarrett
> there is no  "INI_FILE_NAME" or "CONFIG_DIR" in the env; Sorry.

INI_FILE_NAME is exported by the main linuxcnc script and will be in
the environment of any process started by that script (such as the
program specified by the ini setting [DISPLAY]DISPLAY)

Ref:
github.com/LinuxCNC/linuxcnc/blob/master...pts/linuxcnc.in#L257
github.com/LinuxCNC/linuxcnc/blob/master...pts/linuxcnc.in#L804


> About that stat() ?  
The stat variable ini_filename (2.9 & master branches):
github.com/LinuxCNC/linuxcnc/blob/master...ntf/emc_nml.hh#L1505

Ref:
github.com/LinuxCNC/linuxcnc/commit/f16a...80ce213b8aed88cae9c7

 

Please Log in or Create an account to join the conversation.

More
23 Nov 2022 23:23 #257527 by udoS
@dgarrett
Hi,
thanks for your effort; but the thing is that there are no "NON" of the env vars visible in respect to linuxcnc;

 
Attachments:

Please Log in or Create an account to join the conversation.

More
24 Nov 2022 08:52 #257545 by udoS
@dgarrett
Hi,
what I understand:
setting var in one shell e.g. "xfce4-terminal" or "lxterminal"
udos@cnc-next:~$ MY_VAR=my_var
udos@cnc-next:~$ export MY_VAR
udos@cnc-next:~$ echo $MY_VAR

BUT: that MY_VAR is only available in the same shell/process or child-shell/process;
If I run a new app/process, then those vars are not set/there; not available;
So to have them available, the new app/process would need to be a child of linuxcnc-env;

Best Regards
 

Please Log in or Create an account to join the conversation.

More
24 Nov 2022 09:04 #257546 by rodw
In your home folder there should be a hidden file called .profile
I think (but could be wrong) if you add your commands in that file and reboot or even just logout, they should be persistent.

Please Log in or Create an account to join the conversation.

More
24 Nov 2022 09:45 #257550 by udoS
@rodw
Thanks, but the problem here is:
the $HOME/linuxcnc/config/anyConfig/anyName.ini
can always be different;
I start my app and have to check if or if not LinuxCNC is running;
If not then start it;
then I read from the .ini some values;
a.s.o. ......

Please Log in or Create an account to join the conversation.

Time to create page: 0.140 seconds
Powered by Kunena Forum