fs_driver.py: don't remove / from /

This commit is contained in:
Thomas Farstrike
2025-11-23 05:26:34 +01:00
parent 04a27b069c
commit 09c5249203
+3 -2
View File
@@ -79,10 +79,11 @@ def _fs_dir_open_cb(drv, path):
#print(f"_fs_dir_open_cb for path '{path}'")
try:
import os # for ilistdir()
path = path.rstrip('/') # LittleFS handles trailing flashes fine, but vfs.VfsFat returns an [Errno 22] EINVAL
if path != "/":
path = path.rstrip('/') # LittleFS handles trailing flashes fine, but vfs.VfsFat returns an [Errno 22] EINVAL
return {'iterator' : os.ilistdir(path)}
except Exception as e:
print(f"_fs_dir_open_cb exception: {e}")
print(f"_fs_dir_open_cb exception for path {path}: {e}")
return None
def _fs_dir_read_cb(drv, lv_fs_dir_t, buf, btr):