Is PC Cleaning software interfering with IDE 2.3.2?

I was working in Arduino IDE 2.3.2 last night and got tired so I left the IDE Open with my sketch. When I got back to the IDE today I noticed the sketch tab is gone. Image Below. Windows 10 Pro PC/Laptop.

The sketch is no longer there. I was using the IDE with Teensy but I've had this problem before regardless of microcontroller. I use CCleaner Professional to clean up files and have it set to clean automatically, I am "Assuming" CCleaner is the culprit and I may need to add some Arduino IDE folders/files to my exclusion list within CCleaners Options. Does/did anyone have a similar issue or is this a completely different issue.

Regardless, just to be safe, is there a list of folder/files I can tell CCleaner to stay away from on Windows 10 Pro installations. I think the app is cleaning a cache folder the IDE may use. I know a few locations Arduino IDE uses but I don't have a full list I can tell CCleaner not to touch.

Thank you in advance
Jorge

Hi @japreja.

I think you are right. When you create a sketch via File > New, Arduino IDE stages the sketch files under the system temporary folder. The Arduino IDE editor automatically syncs any external changes that are made to those files, so if the temporary folder is cleared then it also clears the staged sketch from the Arduino IDE editor.

Staged Sketches

Unfortunately Arduino IDE doesn't store staged sketch files under a dedicated parent folder, which might make this a bit more difficult to accomplish. The staged sketches are stored under paths with the following format:

C:\Users\<username>\AppData\Local\Temp\.arduinoIDE-unsaved<differentiator>\

where <username> is your Windows username and <differentiator> is some randomish text that makes each folder name unique. So if CCleaner allows configuring exclusions using patterns (e.g., regular expressions, globs) instead of only explicit paths then you can simply configure the pattern to exclude anything path with the static initial part C:\Users\<username>\AppData\Local\Temp\.arduinoIDE-unsaved.

Compilation Cache

When you compile a sketch, Arduino IDE saves the compiled board core and libraries to a cache. It will then reuse the cached objects during subsequent compilations for that board unless the core or library source code has changed (e.g., you updated the boards platform or library to a newer version).

This is useful because it reduces the time it takes to compile sketches. Even though CCleaner deleting the compilation cache won't cause any significant problems, since Arduino IDE should just do a full compilation if it doesn't find a cache, the cache is useful so I suggest you also exclude it in the CCleaner settings.

Fortunately in this case the configuration will be easier because they are stored under dedicated parent folders:

Core cache:

C:\Users\<username>\AppData\Local\Temp\arduino\cores\
C:\Users\<username>\AppData\Local\Temp\arduino\sketches\

(where <username> is your Windows username)

CCleaner has advanced options in the Professional/Paid version that allow saving CCleaner options to an INI file. This is required for the following to work by editing the .ini file.

  • In CCleaner navigate to "Options" "Advanced" and select the save to .ini option, make sure it is checked/enabled.
  • Exit CCleaner completely
  • Open a text editor as Administrator then open file and select (on windows):

C:\Program Files\CCleaner\ccleaner.ini

  • Scroll all the way to the end and add the following lines (change USERNAME with your user name for each line if necessary):

Exclude1=PATH|C:\Users\USERNAME\.arduinoIDE\|*.*||0|0|24
Exclude2=PATH|C:\Users\USERNAME\AppData\Local\Arduino15\|*.*||0|0|24
Exclude3=PATH|C:\Users\USERNAME\AppData\Local\Temp\.arduinoIDE-unsaved*\|*.*||0|0|24

  • Save the file, exit the editor.
  • Restart CCleaner

You can also add entries one by one in the CCleaner "Options"/"Exclude" area. More information on the use of these INI files options with CCleaner is on the CCleaner help/howto page:

How to exclude files, folders, and registry keys in Windows versions

CCleaner can use wild cards in file names and folders so this should work fine. There may be additional paths that Arduino IDE uses. Mine seem to be in Arduino15 folders because of upgrades but A PC that has never had Arduino IDE installed may actually us "Arduino" or "ArduinoIDE".

I haven't been able to test if this prevents the error from the first post, I will see tonight.

Thanks for sharing your solution!

Yes, but I would be very surprised if CCleaner messed with the files under those paths. That would be very harmful behavior.

Automatically clearing files from the system temporary folder is more reasonable (though I personally I don't see the need for such a thing and would never use a program like CCleaner on my own system).

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.