a question with regards the contents of the aforementioned directory (Linux).
Does anyone know whether the contents of this directory can be purged after a sketch has been compiled and uploaded?
I'm thinking about a script scheduled by cron every night at a given time.
Any ideas?
You should probably keep the cores until you update a board or boards plural. Then wipe that and let them re-cache on the next build(s).
Looks like the sketches are also kept forever. Shouldn't be a problem wiping that nightly, as long as that's not when you're actually in the middle of building something.
So every ten compiles, it should purge everything older than 30 days. That ain't happening.
OK, here's the main problem. During a build, the temp directory for that specific sketch is computed
and then defer maybePurgeBuildCache is called, but only with the purge count and TTL from the settings. But at the end of that function
if the purge count passes, the call is made with the TTL. But that's the wrong root directory -- it's under /temp or /private -- when instead it should be under ~/.cache or Caches. So nothing ever gets purged.
The minimum fix is to pass the recently-computed buildCachePath as an additional argument and then
Hi @domify80. When you compile a sketch in Arduino IDE, it first checks this ~/.cache/Arduino/sketches folder to see if it has already cached the compiled output for the given Arduino boards core, library, or sketch file. If so, it simply reuses the cache instead of compiling from source. This reduces the duration of the compilation operation. That can save a lot of time in the case of complex cores, libraries, or sketches.
You can delete that folder without breaking anything, but if you do that then Arduino IDE will have to compile everything from source once again.
If you are really short on hard drive space, then maybe it would make sense to delete this folder, but otherwise you are only hurting yourself by doing that. Even if you are short on hard drive space, I would recommend looking elsewhere to see if you can remove something that serves no purpose.