How to disable opening last sketch on startup?

Hi,

I am teaching intro Arduino coding to 92 seventh graders in a computer lab. Each class size is about 16. When the Arduino IDE automatically opens up the previous student's work it is a huge problem. With the original Arduino IDE I was able to edit a preferences file to disable auto-opening of the previous sketch. However, I haven't been able to figure it out with the 2.0 IDE.

Does anyone have any tips how to prevent this?

Thank you in advance!

Stewart

1 Like

Hi @SM-Makerspace.

I'm not aware of a setting that can be used to disable the restoration of the previous sketches on startup. If you like, you can submit a feature request to the Arduino IDE developers here:

https://github.com/arduino/arduino-ide/issues/new/choose

My first idea was to pass the path of a specific sketch to the IDE as an argument (which can be done via a shortcut, file association, script, etc.). This sketch could simply be the code you get from File > New. You would need to do something to prevent the users from saving changes to this file. That could be done by making the file read only, or having a script that resets the file after each IDE session.

Perhaps a better approach is to clear the data used by the restoration feature. This is stored in two different files in two different locations:

  • The recentRoots field of <configuration folder>/recentworkspace.json
  • The workspaces field of <user data folder>/config.json

If you want to get fancy, you could use a tool like jq to clear the specific fields of these files. But you can also just delete the two files entirely without causing any problem.

"Configuration folder" location

Windows

%HOMEPATH%\.arduinoIDE\

(e.g., C:\Users\<username>\.arduinoIDE\)

Linux

~/.arduinoIDE/

macOS

~/.arduinoIDE/

"User data folder" location:

Windows

%APPDATA%\arduino-ide\

(e.g., C:\Users\<user name>\AppData\Roaming\arduino-ide\)

Linux

~/.config/arduino-ide/

macOS

~/Library/Application Support/arduino-ide/

One option, perhaps not as elegant as the previous suggestion, is to provide each student with their own desktop folder that contains a shortcut to a blank Arduino project saved with the students name eg. JohnDoe_template.ino. Subsequent projects would be saved in the students own folder maybe a sub folder called JohnDoe_repo. It promotes an intro into being organized.

1 Like

Thank you so much for the reply, I'll try this method and the other method suggested from the other reply. Appreciate it!

The formal feature request submitted by @SM-Makerspace:

Thanks!

1 Like

Do we know if this feature request was implemented? It would be really useful.

1 Like

Hi @tadder. The GitHub issue linked above will be closed if the requested feature is implemented.

If you have a GitHub account, you can subscribe to that issue to get notifications of any developments on the subject.

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