Is there a way, in the platformio.ini file, to select or ignore sections depending on system environment (or other reliable method) to determine what OS is running? An if / endif like thing.
I use a Linux (Ubuntu 24), a Win7, and a Win10 for development depending is several unimportant factors.
Example, on Windows there is a system environment variable called OS that is set to Windows_NT, and in Linux I can make one called OS and set it to Ubuntu (or something)
then select (or ignore) a platformio.ini section based on that system environment setting.
I use MEGA to sync Windows MyDocuments and Linux Documents so the source and libraries are the same,
Ugh, my head is getting sore from beating it against my computer.
As I try to install Win10 (triple boot with Ubuntu, and Mint) I remembered setting up a new computer from scratch is a PITA. (sorry, just ranting a bit.)
So, that is taking a lower priority and back to this issue.
sivar2311 mentioned Advanced Scripting, and while that may someday be an option, I’d rather not get too much into the weeds there. However, while researching that, I ran across Interpolation in the platformIO.ini file. So…
I created a system environment…
in Windows… PIOport = COM6
and in Linux… PIOport = /dev/ttyUSB0
As for the home folder, the documentation says I can use
${sysenv.HOME}
so I did… build_flags = -I ${sysenv.HOME}"\Documents\_Projects\ESP_stuff\MyLibs"
and OMG that compiled on Windows at least!! I’ll let you know if it works on Linux.
Thanks,
Mark.
PS, zapta, I started going down a rabbit hole and rant about issues with Linux, but decided this wasn’t the place. Thank you for asking. I spent 30 minutes typing up my issues then deleted it as this wasn’t the place. (I do that a lot when I need to vent.)