Skip to content

std::fs::read_dir issue with spiffs #141

@axos88

Description

@axos88

Executing

    unsafe {
        let base_path = CString::new("/spiffs").unwrap();
        let storage = CString::new("storage").unwrap();

        let conf = esp_idf_sys::esp_vfs_spiffs_conf_t {
            base_path: base_path.as_ptr(),
            partition_label: storage.as_ptr(),
            max_files: 5,
            format_if_mount_failed: true,
        };

        esp_nofail!(esp_idf_sys::esp_vfs_spiffs_register(&conf));
    }

    info!("FS Contents: {:?}", fs::read_dir("/spiffs").unwrap().collect::<Vec<_>>());
    info!("FS Contents: {:?}", fs::read_dir("/spiffs").unwrap().collect::<Vec<_>>());

    fs::read("/spiffs/existing_file").unwrap();

    info!("FS Contents: {:?}", fs::read_dir("/spiffs").unwrap().collect::<Vec<_>>());

Outputs the following:

I (411) doorlock::filesystem: FS Contents: [Ok(DirEntry("/spiffs/account")), Ok(DirEntry("/spiffs/existing_file")), Ok(DirEntry("/spiffs/foo.txt"))]
I (431) doorlock::filesystem: FS Contents: [Ok(DirEntry("/spiffs/account")), Ok(DirEntry("/spiffs/existing_file")), Ok(DirEntry("/spiffs/foo.txt"))]
I (451) doorlock::filesystem: FS Contents: [Ok(DirEntry("/spiffs/account")), Ok(DirEntry("/spiffs/existing_file")), Ok(DirEntry("/spiffs/foo.txt")), Err(Os { code: 5, kind: Uncategorized, message: "I/O error" })]

I have applied the time64 patch to std

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