Skip to content

Save as fails when the path to the sketch contains parentheses () or brackets [] #2043

Closed
greenpdx/arduino-ide
#1
@kittaakos

Description

@kittaakos

Describe the problem

Originally from here: https://forum.arduino.cc/t/new-ide-inst-saving-files-correctly/1122494

Save as fails when the sketch path contains

  • parentheses ()
  • brackets []
  • TODO: check braces {} (it works ✅) and chevrons <> (it works ✅)

Windows:

2023-05-04T10:08:56.640Z root ERROR Request copy failed with error: Cannot copy `c:\Users\kittaakos\Desktop\sketchbooks\test_sketchbook__1\nested(with parentheses)\sketch_3`: the file doesn't exist

macOS:

2023-05-04T10:21:50.093Z root ERROR Request copy failed with error: Cannot copy `/Users/a.kitta/Documents/Arduino/with ()/nested_korte`: the file doesn't exist

To reproduce

  • Open a sketch in IDE2 that has parentheses in the path,
  • Click on File > Save as,
  • Specify a valid sketch folder name, and press OK.

It does not work.


My sketchbook content:

C:\Users\kittaakos\Desktop\sketchbooks\test_sketchbook__1>dir
 Volume in drive C has no label.
 Volume Serial Number is 04F3-13CC

 Directory of C:\Users\kittaakos\Desktop\sketchbooks\test_sketchbook__1

05/04/2023  12:07 PM    <DIR>          .
05/04/2023  12:07 PM    <DIR>          ..
01/19/2023  11:18 AM    <DIR>          nested
05/04/2023  12:08 PM    <DIR>          nested(with parentheses)
01/19/2023  11:18 AM    <DIR>          sketch++
01/19/2023  11:18 AM    <DIR>          sketch_xxx
01/19/2023  11:19 AM    <DIR>          __sketch
               0 File(s)              0 bytes
               7 Dir(s)  217,251,553,280 bytes free

C:\Users\kittaakos\Desktop\sketchbooks\test_sketchbook__1>tree
Folder PATH listing
Volume serial number is 04F3-13CC
C:.
├───nested
│   └───sketch_2
├───nested(with parentheses)
│   └───sketch_3
├───sketch++
├───sketch_xxx
└───__sketch

C:\Users\kittaakos\Desktop\sketchbooks\test_sketchbook__1>

I opened nested(with parentheses)/sketch_3 and performed the Save as command.

Expected behavior

It works.

Arduino IDE version

2.1.0

Operating system

Windows, macOS

Operating system version

macOS 12.6.3 and Windows 10

Additional context

From #1901 (comment):

Thanks! I could reproduce it when creating a cloud copy without renaming the local sketch. The problem was in ncp, so I switched to a new lib and added a few tests.

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