Arduino icon indicating copy to clipboard operation
Arduino copied to clipboard

Project file deleted after adding

Open berikv opened this issue 13 years ago • 8 comments

When I start the Arduino IDE 1.0.4 or 1.5.2 on my Mac, only the ino file is shown in the IDE. The other project files are not show. When I try to add them to in the IDE via "Sketch -> Add file..", the following message appears in the console and the file is gone. YES GONE Actual work has been erased because of this.

Could not createInput() for /path/to/project/3dTransform.h java.io.FileNotFoundException: /path/to/project/3dTransform.h (No such file or directory) at java.io.FileInputStream.open(Native Method) at java.io.FileInputStream.(FileInputStream.java:120) at processing.core.PApplet.createInput(Unknown Source) at processing.core.PApplet.loadStrings(Unknown Source) at processing.app.Base.loadFile(Base.java:2621) at processing.app.SketchCode.load(SketchCode.java:266) at processing.app.SketchCode.(SketchCode.java:80) at processing.app.Sketch.addFile(Sketch.java:1096) at processing.app.Sketch.handleAddFile(Sketch.java:989) at processing.app.Editor$16.actionPerformed(Editor.java:654) at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2028) at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2351) at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:387) at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:242) at javax.swing.AbstractButton.doClick(AbstractButton.java:389) at com.apple.laf.ScreenMenuItem.actionPerformed(ScreenMenuItem.java:95) at java.awt.MenuItem.processActionEvent(MenuItem.java:650) at java.awt.MenuItem.processEvent(MenuItem.java:609) at java.awt.MenuComponent.dispatchEventImpl(MenuComponent.java:343) at java.awt.MenuComponent.dispatchEvent(MenuComponent.java:331) at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:713) at java.awt.EventQueue.access$400(EventQueue.java:82) at java.awt.EventQueue$2.run(EventQueue.java:669) at java.awt.EventQueue$2.run(EventQueue.java:667) at java.security.AccessController.doPrivileged(Native Method) at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:87) at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:98) at java.awt.EventQueue$3.run(EventQueue.java:683) at java.awt.EventQueue$3.run(EventQueue.java:681) at java.security.AccessController.doPrivileged(Native Method) at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:87) at java.awt.EventQueue.dispatchEvent(EventQueue.java:680) at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:296) at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:211) at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:201) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:196) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:188) at java.awt.EventDispatchThread.run(EventDispatchThread.java:122) Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException at processing.app.SketchCode.load(SketchCode.java:268) at processing.app.SketchCode.(SketchCode.java:80) at processing.app.Sketch.addFile(Sketch.java:1096) at processing.app.Sketch.handleAddFile(Sketch.java:989) at processing.app.Editor$16.actionPerformed(Editor.java:654) at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2028) at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2351) at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:387) at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:242) at javax.swing.AbstractButton.doClick(AbstractButton.java:389) at com.apple.laf.ScreenMenuItem.actionPerformed(ScreenMenuItem.java:95) at java.awt.MenuItem.processActionEvent(MenuItem.java:650) at java.awt.MenuItem.processEvent(MenuItem.java:609) at java.awt.MenuComponent.dispatchEventImpl(MenuComponent.java:343) at java.awt.MenuComponent.dispatchEvent(MenuComponent.java:331) at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:713) at java.awt.EventQueue.access$400(EventQueue.java:82) at java.awt.EventQueue$2.run(EventQueue.java:669) at java.awt.EventQueue$2.run(EventQueue.java:667) at java.security.AccessController.doPrivileged(Native Method) at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:87) at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:98) at java.awt.EventQueue$3.run(EventQueue.java:683) at java.awt.EventQueue$3.run(EventQueue.java:681) at java.security.AccessController.doPrivileged(Native Method) at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:87) at java.awt.EventQueue.dispatchEvent(EventQueue.java:680) at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:296) at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:211) at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:201) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:196) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:188) at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)

berikv avatar Apr 28 '13 11:04 berikv

Can you be more precise on the behavior you are experiencing? I'm not able to replicate your problem.

Fede85 avatar Apr 29 '13 16:04 Fede85

I would like the IDE to recognise the files in the project, and show a tab per file. Instead it opens with just the ino, not the other source files.

Then when adding the files from the project, I expect them to appear as tabs in the IDE. Instead the IDE DELETES the files.

berikv avatar Apr 29 '13 16:04 berikv

Let me clarify by adding the exact steps to reproduce:

  • Open Arduino.app on a Mac computer
  • Create a new project
  • Save as test
  • Quit Arduino
  • Go to the project directory (~/Documents/Arduino/test)
  • Place some source files inide the project directory (let's say ~/Documents/Arduino/test/test.h)
  • Start Arduino

Notice that the added source files do not appear in the IDE.

  • Chose Sketch -> Add File...
  • Select one of the added source file

Notice that the source file has disappeared

berikv avatar Apr 29 '13 16:04 berikv

I'm on a Mac as well and I can't reproduce this issue either. Everything shows up as intended. I'm running Mac OS X 10.8.3 and the newest version of Java.

Lauszus avatar Apr 29 '13 16:04 Lauszus

The previous reproduction steps did not always yield the bug. After some more testing, I came to a reproducible description:

  • Open Arduino.app on a Mac computer
  • Create a new project
  • Save as test (~/Documents/Arduino/test)
  • Quit Arduino
  • Place a source file starting with a number next to the ino, eg: ~/Documents/Arduino/test/3dTest.h
  • Start Arduino

Notice that the added source files do not appear in the IDE.

  • Chose Sketch -> Add File...
  • Select one of the added source file

Notice that the source file has disappeared

berikv avatar May 01 '13 08:05 berikv

I can confirm that its indeed deletes the file. Does it give you the warning: "Replace the existing version of 123Test.h"? It looks like it sees the file, but can't show in the Arduino IDE.

I also found out that if you select an existing file that it already shown as a tab it will delete it. That might cause problems as well.

Lauszus avatar May 01 '13 12:05 Lauszus

Thank you @berikv and everyone for spotting this. Current IDE 1.5.4 and 1.0.5 does not delete these extra files. However, current IDE, due to a legacy from Processing, does not allow sketch files to start with a digit. I'm likely to close this bug as Fixed. What do you think?

ffissore avatar Oct 14 '13 11:10 ffissore

If the IDE does not delete the file, but give a warning instead, the problem is solved.

berikv avatar Oct 14 '13 12:10 berikv