Duplicate cpp files in same project

I'm using 2.1.0 IDE on Win 10. It's been pretty well-behaved lately, but today was weird. I have 24 files in a project. I did a global search and replace (this is the first time I've used it cuz I feel it's dangerous in most cases) and it opened up a second copy of one of the files where the target of the search was found. I closed the "right-hand copy" using the corner 'X' and that one did close down. However, when I looked at the Tab list, there are now two copies of that file. One of them is "locked" in the sense I cannot edit it. The other file is not. I loaded up File Explorer and inspected its properties and was, indeed, marked Read-only. FE shows only one copy in the directory.

Did I do something wrong that resulted in this, or is this by design. If by design, is there a way to turn that feature off.

I don't think you did something wrong. It sometimes just happens. The issue has been reported a couple of times on the forum; the relevant report on github is Two tabs open for same file and won't close · Issue #1791 · arduino/arduino-ide · GitHub.

It contains instructions how to clear it (reset workbench by per1234 and an addition to that by sterretjeToo; I'm not sure if this already made it to IDE 2.1.1.

I have moved your topic to the dedicated IDE 2.x section of the forum.

arduino/arduino-ide#1791 was closed as fixed by arduino/arduino-ide#1969

That fix was included in the Arduino IDE 2.1.0 release (and thus in 2.1.1 as well).

OK, thanks.

That raises the question if it was actually fixed :wink: @econjack uses 2.1.0

Note:
When I encountered the issue, the second of the duplicates was not read-only; I could edit both (as far as I remember). So this might be another issue.

If this happens again, I'll try to get screen shots to post. I hope it doesn't happen, but if it does...

1 Like

There have been several other reports of sketch files unexpectedly gaining read-only attributes:

One of the affected users determined it was caused by a Windows update:

Something important to understand related to this problem is that Arduino IDE intentionally treats some files as "read-only" simply based on their location outside the sketch folder. That system does not use file attributes so it is not expected that the IDE would ever add a read-only file attribute under any conditions.

When I upgraded to 2.1.1, I was having my "Exit-only" problem which caused me to drop back to 2.1.0. With this "append" problem, I decided to try 2.1.1 again. Now, 2.1.1 works fine and I have not experienced the append problem. If I do, I'll report it here.

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