BUG REPORT - IDE keeps creating nested folders when you manually save

Every time I manually save my project the IDE is creating a new nested folder inside the folder from which the sketch was loaded from.

It is EXTREMELY annoying. You need to make it so it saves everything to the current folder.

It should be like every other software package I have ever used.

'Save as' option create the sketch folder in a new location.

Which operating system?
What is the sketchbook location?

So you have

sketchbook
+-- sketch
    +-- sketch.ino

and after manually saving you have the below?

sketchbook
+-- sketch
    +-- sketch.ino
    +-- sketch
        +-- sketch.ino

If so, I have never observed the behaviour but that's maybe just my luck.

The latter. Every time. Windows 10

And it is not like it gives you the option to browse up a folder and then save. But if you did that it might whinge about the folder name already being in use LOL

When it autosaves it does not create any nested folder.

Not sure if I understand. If you manually save using file → save (or <ctrl>S) it's expected not to give you the option, it will just overwrite the the sketch files (.ino, .cpp, .h etc).

I forgot to ask, which exact version of the IDE? What type of install? ZIP, exe, msi?

Yes that's correct. It should just overwrite the sketch files (.ino, .cpp, .h etc). But it does not. It creates a new sub folder and saves all the files in that instead.

Version 2.3.4

If you change the name of the sketch a new folder will be created.

I found an old issue (for IDE 1.x (!); Why does Arduino save with folder in folder?) and it relates to network drives. Are you using a network drive? Or maybe OneDrive or similar)?

I don't think that I can help further.

For what it is worth, this is my sketch folder.

If I click 'save' then it will create a new subfolder in here called 'LEDSignBoard' and copy all my source files to this new subfolder.

Does the same behaviour happen with a sketch on the C-drive?
Does the same behaviour happen with a simple sketch?

I don't save sketches on C drive for obvious reasons - because windows 10 is on it!

But I will try and get back to you.

It didn't do it with a simple sketch on C: drive.

And I just tried it again on my complex sketch on E: drive and it didn't do it.

Is it possible the autosave is doing it from time to time somehow?

Occasionally the USB plug for E: drive works loose and E: drive goes off line with the sketch open in the IDE. And correct the plug and E: drive comes back online.

Is it possible that autosave then does something weird in that situation.

If it can't find the folder then the IDE should throw a file browse prompt.

So that works as expected.

I do not know but have doubts. You can switch autosave of if that would help with testing.

  1. Press <ctrl><shift>P
  2. Type auto save
  3. Change the setting by clicking on it.

That might be a pointer; I suspect that if you loose the connection you will loose the file handle to the directory. Any chance of replacing the cable to see if it will solve the issue?

I tried to simulate with a memory stick. Removing the stick before the autosave kicks in results in below message.


and the sketch disappears from the IDE.
I have to re-open the sketch from the memory stick.

Observation:

  1. No sketch inside sketch is created.
  2. Trying to save the sketch with the memory stick still disconnected does not result in an error. Just in case it was saved elsewhere I scanned my hard drive (Documents folder) and could not find it.

You can log a feature request at https://github.com/arduino/arduino-ide/issues.

Were you able to reproduce the error on a USB drive, taking it off and on line?

I unfortunately don't have an USB hard disk that I can sacrifice so tried to simulate with a memory stick.

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