Skip to content
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

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

Open
axos88 opened this issue Oct 16, 2022 · 0 comments
Open

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

axos88 opened this issue Oct 16, 2022 · 0 comments

Comments

@axos88
Copy link
Contributor

axos88 commented Oct 16, 2022

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Todo
Development

No branches or pull requests

1 participant