Where should this file go on Mac OSX? I've tried a couple of locations but haven't gotten found the right directory yet.
I've tried /Applications/Arduino\ IDE.app/hardware/platform.txt, /Applications/Arduino\ IDE.app/Contents/hardware/platform.txt, ~/Library/Arduino15/packages/esp32/hardware/platform.txt and a few others, but so far no luck.
Yes, I saw that thank you. What does that translate to on a Mac? Like I said I tried /Applications/Arduino\ IDE.app as well as /Applications/Arduino\ IDE.app/Contents and neither worked.
When I search, there is no existing hardware folder under /Applications/Arduino\ IDE.app/
The instructions imply you need to create a folder called 'hardware' but the mention of Arduino IDE installation folder is a bit confusing. At first you might think it's the Applications folder, but I suspect it's the hidden folder called .arduinoIDE. The (period). means it is hidden by default, so do an unhide via Shift-Command-. (period key)
Here is what it looks like and the existing contents of the .arduinoIDE folder. Yes I am on a Mac too.
EDIT: This is located under your user name folder.
Is that a Linux box? The Mac does not look like that. The same stuff is there but it is inside the apparent app which you can see by doing a Show Package Contents. Given that , it is unlikely that is the location as it doesn't exist on a Mac.
Show me how you plan on adding the 'hardware' folder to the Arduino.app. Even if you could, every update of the app would wipe it out.
This is what is in the manual.
Properties defined in a platform.txt created in the hardware subfolder of the Arduino IDE installation folder will be used for all platforms and will override local properties. This feature is currently only available when using the Arduino IDE.
The way I understand that is that the IDE installation folder is the hidden folder named .arduinoIDE
The easiest way to resolve this is to create the hardware folder, copy an existing platform.txt file and remove most of it leaving an entry that you can modify in a way that will be obvious. Now Take that same file and stick it in the .app.
On my mac, the app is called "Arduino IDE" with a space, and on the filesystem it's called "/Applications/Arduino IDE.app". Some shells use a backslash to escape the next character, so sometimes you'll see /Applications/Arduino\ IDE.app instead of "/Applications/Arduino IDE.app", but it means the same thing.
Ah yes there is a space, but it changes nothing. You can't add a folder to an app as far as I know.
This isn't something I am likely to use so don't care one way or the other, but the OP should do a simple experiment using the folder I recommend (user).arduinoIDE and add the hardware folder then a platform.txt file in there with some contents he will know affected his verify in a known way. I only have a very rough idea how that works as I have never used it but a friend of mine had to make one at the platform level to get his library to work.
Good luck.
Please provide a detailed description of what you are trying to accomplish via the global platform.txt. The forum helpers may be able to suggest alternative ways to accomplish your goal.
I'm using recipe.hooks.sketch.prebuild.1.pattern hooks to preprocess some files before building. This lets me take advantage of more advanced tools like StateSmith.
The various platform.txt files are not perfect for this because they are global to my installation rather than specific to an individual project, but I was able to make them pseudo project-specific by having them look for a script in each project, and do nothing if it's not there.
The main remaining downside of using platform.txt is that it gets replaced whenever I upgrade the platform. I thought using the global platform.txt would make this less likely to occur.
But really, what I really want is the ability to specify build hooks per-project.
Arduino IDE 2.x remembers the custom board option selections you had the last time a given sketch was open, and automatically selects that board option when you open the sketch again. So this would achieve a per-project configuration.
Definitely. You can mitigate the problem by putting your build hook definitions in a dedicated file named platform.local.txt, placed in the same folder as the platform's boards.txt file:
These *.local.txt files will be lost each time you update to a new version of a platform. However, you can easily reapply your modifications afterwards by saving a copy of the files to a safe location outside the platform installation folder, then simply copying the file(s) back into the platform folder after the update.
You are probably already aware, but make sure to restart Arduino IDE (or run the "Arduino: Restart Daemon" command from the "Command Palette") after you make any changes to the platform configuration files (including adding or editing *.local.txt files), as Arduino IDE won't recognize any changes you make while it is running.