Skip to content

Subfolder structure of sketch lost after "Save As" operation #2077

Closed
@jsmwrench

Description

@jsmwrench

Describe the problem

Arduino sketches may contain files under subfolders:

🐛 After a "Save As..." operation, any subfolders are lost and the files are all moved to the root sketch folder.

To reproduce

  1. Click the following link to download the demonstration sketch:
    HasSubfolders.zip
  2. Unzip the downloaded file.
  3. Take note of the file structure of the sketch:
    HasSubfolders/
    ├── HasSubfolders.ino
    └── src/
        └── FromSubfolder.h
    
  4. Select File > Open from the Arduino IDE menus.
  5. Select the HasSubfolders.ino file from the unzipped folder.
  6. Select File > Save As..." from the Arduino IDE menus.
  7. Save the sketch to any convenient name and location.
  8. Select Sketch > Show Sketch Folder from the Arduino IDE menus.

🐛 The subfolder structure of the sketch was lost:

HasSubfoldersAfterSaveAs/
├── FromSubfolder.h
└── HasSubfoldersAfterSaveAs.ino

Expected behavior

A "Save As" operation does not make any changes to the sketch file structure.

Arduino IDE version

94d2962

Operating system

  • Windows
  • Linux
  • macOS

Operating system version

  • Windows 11
  • Ubuntu 22.04
  • macOS Ventura

Additional context

I bisected the regression to 0ab2826 (the fault does not occur when using 2aad0e3).

Additional reports

Issue checklist

  • I searched for previous reports in the issue tracker
  • I verified the problem still occurs when using the latest nightly build
  • My report contains all necessary details

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions