Arduino IDE doesn't accept sketch names ending with a dot

I have a folder named F.O.O. with a file named F.O.O..ino in it. I tried to open F.O.O..ino as a sketch, but it didn't work: the IDE complained that "a filename cannot end with a dot". I've checked the Sketch specification, and it doesn't specify this as a requirement. Who is wrong here? What is the problem in making a filename end with a dot, anyway?

The problem is, many OS use the dot as a special delimiter to denote file types. Don't use it.

Shouldn't the sketch specification, that explicitly says I can use dots in the filename, be updated then?

Can you quote it?

Link to the specific section

The sketch root folder name and code file names must start with a basic letter (A-Z or a-z), number (0-9), or underscore (_) followed by basic letters, numbers, underscores, dots (.) and dashes (-). The maximum length is 63 characters.

It says dots are okay after the first character, and it doesn't limit at all the last character.

It is not supported by the Windows operating system:

Do not end a file or directory name with a space or a period. Although the underlying file system may support such names, the Windows shell and user interface does not.

Curse you, Bill Gates!

I hadn't realized that Windows specific limitations where enforced by the IDE in Linux. I guess it makes sense, for ensuring maximum interoperability.

While rewriting explicitly all Windows specific limitations in the specification is obviously overkill, wouldn't it be better to put at least a note saying that Windows limitations also apply? Just to avoid future Linux users posting "I tried to create a sketch named CON and the IDE doesn't want it".

The Arduino Desktop IDE only allows one dot in the extension. If you use two dots, the IDE will not be able to recognize or open your sketch. You should always name your sketch with a valid extension.
However, it is a general convention in programming that file names should not contain consecutive periods. This could lead to confusion or errors when file names are processed by the operating system or applications.
I hope I was able to help. Is it bad if you can't stop that sketch name with a period?

Nah it's not important, I was just confused because the limitation apparently came out of nowhere.

Not true.

... and operating systems do not need or require extensions. You can right-click >> open with any file with any app. The extension merely lets the OS launch a preferred app.

In only see a single dot in your sketch name. And that sketch name is not the filename but actually the directory where the .ino file is located. You can fiddle a bit more if you want; call your sketch e.g. sketch.x. (including the trailing dot); that might fail.

From memory, Linux is far more intelligent than Windows when it comes to that. It e.g. knows that a file is a MP4, even if it does not have an extension. I've made plenty mistakes renaming movies and omitting the last dot so it looked like "myMovie.01mp4" and Linux happily opened it.

Yes, the trailing dot is invalid, both commandline or windows shell. When the 8.3 convention was "all we had" a file was still valid without the .3 extension. Longfilenames still had an 8.3 shortname (DifferentFileForNano.ino and DifferentFileESP32.INO had shortnames of DIFFER~1.INO, DIFFER~2.INO). Linux is a champion. Unforgivable at times, but allows you to mess up and still recovers. I once clobbered my boot sector (thinking I was formatting a thumb drive), but with a little Linux USB, the five remaining copies of boot sector were enough to reconstruct my hard drive. Such a kind OS.

I agree completely. The need to update the specification was added to the "to do" list at the time the restriction was implemented in Arduino IDE:

Work is now in progress to update the specification and also to implement the equivalent check in the arduino-cli sketch new command of the Arduino CLI tool:

1 Like

So then you opened a new project, put the F.O.O. code in and named it FOO, right?

We format SD cards with FAT32 file system, not Winblows. The SD card looks like a DOS drive then.

Will Arduino change that or just use it correctly as most of us do now?

This change only applies to the filenames of the Arduino sketch projects that are stored on the user's PC hard drive.

It does not have any affect on the behavior of how the firmware that runs on Arduino boards works with file systems (such as is done by sketches that use the Arduino SD library to work with file systems on SD cards).

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