Function file file_exists in .adef

Hi,
I want my application to work on FX30 (WP77xx, legato 18.10) and mangOH Red (WP77xx, legato 18.10) without recompiling source every time, I want to change a unit.
I should have one .update file for both units. Unfortunately, mangOH Red uses I2C-5 and FX30 I2C-4.
When I add to .adef file:

requires:
{
device:
{
[rw] /dev/i2c-4 /dev/i2c-4
[rw] /dev/i2c-5 /dev/i2c-5
}
}

application crashes on FX30, because /dev/i2c-5 does not exist. Error - file does not exist.

Based on documentation (https://docs.legato.io/latest/defFilesFormat.html) I changed .adef file to:

requires:
{
device:
{
#if file_exists(/dev/i2c-5)
[rw] /dev/i2c-5 /dev/i2c-5
#else
[rw] /dev/i2c-4 /dev/i2c-4
#endif
}
}

It would work if function file_exists worked. The function returns false even if /dev/i2c-5 exists.

Can we create a dynamic link /dev/i2c-x in file system by ln command?
If yes, you can link to this device node in the adef file

Hi,
How can I create dynamic link and link it? Have you got example?

Not sure if this works but you can have a try
ln -s /dev/i2c-4 /dev/i2c-x

Hi Bartek,
I think you can try making your application unsandboxed, then you can remove the I2C devices from your adef and just use the required one from within your app.
BR,
Chris