How to get the full path to programs folder in the simulator?

Hi,
What is the recommended way to get the full path to the programs directory from inside a URCap? We would like to implement a solution that works on the real robot and in the simulator, so we cannot hardcode “/programs” as a string.
I could use a Linux system call e.g. “pwd” but it looks like a quick and dirty hack.
Thanks
Csaba

You could check if the “/programs” folder exists, if it doesn’t reroute the path to the simulator folder which by default should be “/home/ur/ursim-current/programs”.

2 Likes

if you want to check: realRobot / simulation

com.ur.urcap.api.domain.robot

boolean isRealRobot()
Returns:
true if controlling the real, physical robot and false if in simulation mode.

2 Likes

You can connect to the Dashboard Server, send the command get loaded program and extract the programs path from the returned value.

1 Like