-
Notifications
You must be signed in to change notification settings - Fork 13.3k
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
isDir always false, so code has no effect #7002
Comments
Maybe bool isDir = dir.isDirectory() will work |
Indeed the line:
should be changed to:
(The OP is talking about the ESP8266WebServer example sketch at https://github.com/esp8266/Arduino/blob/master/libraries/ESP8266WebServer/examples/FSBrowser/FSBrowser.ino) |
This fails for ESP8266 because entry.isDirectory() is invalid for ESP8266 |
|
@brownrb would you like to do a PR with this small change, since you found it? |
What is a PR |
Pull Request on github |
@brownrb , could you generate a pull request with the fix? You've found the bug and solution, and it would be a good way to get your name in the commit logs for posterity. :) |
What is a pull request?
On Monday, February 10, 2020, 06:19:56 AM GMT+13, Earle F. Philhower, III <notifications@github.com> wrote:
@brownrb , could you generate a pull request with the fix? You've found the bug and solution, and it would be a good way to get your name in the commit logs for posterity. :)
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or unsubscribe.
|
A quick test with LittleFS and directories shows the fix to be more complicated than it looks. Replacing with So, the fix needs to also incorporate a new .js file that can handle subdirs. It's a can of worms. :( |
If nobody is working on this, I can try to fix it because this FSBrowser is a little gem I include in all my projects and I'm also facing issues migrating to LittleFS due to it. |
@vdeconinck that would be great! I'm curious, though, if it is worth the effort. We might want to drop this and just have the SDFSBrowser instead. I think I've hacked it personally with just a few changes to run on LittleFS (since SD and LittleFS and SPIFFS now have the exact same API, it's almost just a matter of changing the startup code to call LittleFS.begin())... |
@earlephilhower Ahem I can't seem to find SDFSBrowser anywhere (searched my Arduino install folder, searched Github, even asked Google to no avail). Care to point me to that file ? |
Sorry, had the wrong name. It's this: https://github.com/esp8266/Arduino/tree/master/libraries/ESP8266WebServer/examples/SDWebServer If you change the SD.begin() with LittleFS.begin() it almost works (I think I had 1 more change somewhere), and has subdir support. |
Thanks. I played a bit with the SDWebServer example I had completely overlooked till now, and modifications to make it work with LittleFS are minor indeed, so I would advise the OP to switch to that version: |
I think that would be a good PR, @vdeconinck . In that PR, you can delete the FSBrowser example since it's being superseded. |
OK. I'll try to wrap up something clean and tested on all 3 filesystems. |
I'm making good progress. Two questions though:
|
I can confirm that it does save when used with spiffs. I use it regularly to develop my app's web interface. |
OK, thanks. I must have broken something. I'll check the difference with the original code. |
Re: editor: I admit I never realized it was an actual editor. I always thought it was a viewer :-). CTRL-S did work and still works ;-). |
About improving things: please keep in mind that one use case for the esp8266 is in isolation, i. e. not connected to the internet. That means no access to 3rd party js libs. |
@devbyte Err, that code already relies on ace.js being downloaded from a CDN on the internet... |
That's exactly what I was aiming for, thanks! |
Thanks for not holding your breath ;-) Hope you'll like this unified version "on steroids". |
Closing as fixed thanks to #7182 |
in FSBrowser.ino
Line 195 sets isDir false
bool isDir = false;
then a test in line 197 tests the state of isDir which will always be false
output += (isDir) ? "dir" : "file"
Nowhere is the value of isDir changed, so this code has an error.
The text was updated successfully, but these errors were encountered: