Skip to content

LittleFS difference between starting with dir.next() and dir.rewind() #6958

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
4 of 6 tasks
NicoZuid opened this issue Dec 29, 2019 · 0 comments · Fixed by #6959
Closed
4 of 6 tasks

LittleFS difference between starting with dir.next() and dir.rewind() #6958

NicoZuid opened this issue Dec 29, 2019 · 0 comments · Fixed by #6959
Assignees
Milestone

Comments

@NicoZuid
Copy link

----------------------------- Delete below -----------------------------

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: ESP-12
  • Core Version: 2.6.3
  • Development Env: Arduino IDE
  • Operating System: Windows10

Settings in IDE

  • Module: Wemos D1 R2
  • Flash Mode: ?
  • Flash Size: 4MB
  • lwip Variant: ?
  • Reset Method: ?
  • Flash Frequency: ?
  • CPU Frequency: 80Mhz
  • Upload Using: SERIAL
  • Upload Speed: 115200

Problem Description

The iteration after a dir.next() starts with the third entry of the directory.
The entrys with the name . (dot) and .. (dot dot) are skipped.
After a dir.rewind() these entries will be included.
In the current PIFFS version, the first two entries are skipped in BOTH versions.

MCVE Sketch

//To test by adding in example LittleFS_Timestamp in the listDir() function at the end:

Serial.println ("REWIND");
  root.rewind ();
  while (root.next ()) {
    File file = root.openFile ("r");
    Serial.print ("FILE:");
    Serial.print (root.fileName ());
    Serial.print ("SIZE:");
    Serial.println (file.size ());
  }

//(the SPIFFS version can also be tested with this option)
earlephilhower added a commit to earlephilhower/Arduino that referenced this issue Dec 29, 2019
Fixes esp8266#6958

To match SPIFFS, we get rid of the "." and ".." dirents when we open a
directory on LittleFS.  Do the same on a rewind().
@earlephilhower earlephilhower added this to the 2.7.0 milestone Dec 29, 2019
@earlephilhower earlephilhower self-assigned this Dec 29, 2019
earlephilhower added a commit that referenced this issue Dec 30, 2019
Fixes #6958

To match SPIFFS, we get rid of the "." and ".." dirents when we open a
directory on LittleFS.  Do the same on a rewind().
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants