Skip to content

SPIFFSFS class should not shadow methods in FS class #2750

Closed
@judge2005

Description

@judge2005

Please see espressif/esp-idf#3427 for code samples, platform details and discussion. To summarize:

The FS class is not designed to be subclassed insofar as none of its methods are virtual. Re-implementing those methods in SPIFFSFS does not override them, it hides them, so instances of SPIFFSFS can not be passed as references or pointers to the FS class. If they are, the FS methods will be called instead and will not work reliably for a SPIFFS filing system (the existing unit tests are all positive - they test that things work when the files are as they are supposed to be, they don't test negative situations such as files not actually existing).

Instead, an instance of a SPIFFSFS class (such as the instance called SPIFFS) should inject a SPIFFS-specific implementation class into the superclass.

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