mirror of
https://github.com/arduino/Arduino.git
synced 2025-02-18 12:54:25 +01:00
In preferences files, platform-specific versions can be indicated by a .linux, .windows or .macos suffix on the key name. Previously, these keys were loaded as normal and then afterwards, all keys were scanned after loading them and any platform-specific versions replaced the regular ones. However, this means that these platform-specific versions get an unexpected form of priority. Normally, when a single key is set twice, the latter overrides the first. However, the platform-specific values could override the regular versions, even when the regular version occurs later in the file. This problem was particularly confusing when using the new platform.local.txt: a regular preference in platform.local.txt did not override a platform-specific preference in platform.txt. This commit changes behaviour to process these suffixes directly as they are read from the preference files. If a suffix for the current platform is found, the line is processed as if the suffix was not present. If a suffix for another platform is found, the line is ignored altogether. This can slightly change the way preferences files are parsed, but as long as platform-specific preferences are defined after the corresponding regular preferences, the behaviour should be the same.