Skip to content

Files created without leading / in filename are nowhere #4748

Closed
@borisneubert

Description

@borisneubert

Basic Infos

  • This issue complies with the issue POLICY doc.
  • I have read the documentation at readthedocs and the issue is not addressed there.
  • I have tested that the issue is present in current master branch (aka latest git).
  • I have searched the issue tracker for a similar issue.
  • If there is a stack dump, I have decoded it.
  • I have filled out all fields below.

Platform

  • Hardware: ESP8266 (NodeMCU 4M)
  • Core Version: latest, 2.4.1
  • Development Env: Platformio
  • Operating System: Ubuntu

Settings in IDE

  • Module: Wemos D1 mini
  • Flash Mode: dio
  • Flash Size: 4MB
  • lwip Variant:
  • Reset Method:
  • Flash Frequency: 40Mhz
  • CPU Frequency: 80Mhz
  • Upload Using: SERIAL
  • Upload Speed: 921600

Problem Description

The documentation states that a filename needs to start with a slash but this is not quite obvious. Trying to open a file for writing whose filename has no leading slash is successful. I can even write to the file, close it and determine its size afterwards. It only does not show up in a directory listing.

Either opening a file whose filename does not start with a leading slash should fail in the first place or the leading slash should be implicitely added.

Code Snippet

String filename= "bar.txt";
File file= SPIFFS.open(filename, "w");
file.write((uint8_t*)buffer, 8);
file.close();

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions