Skip to content

createFile doesn't return NULL when it fails #56

Open
@sebromero

Description

@sebromero

The documentation of createFile says @return A File object if successful, NULL if not. . However the implementation is as follows:

UFile Folder::createFile(const char* fileName, FileMode fmode) {
    std::string filePath = this->path + "/" + fileName;
    Arduino_UnifiedStorage::debugPrint("[Folder][createFile][INFO] Creating file: " + String(filePath.c_str()));
    UFile thisFile;
    thisFile.open(filePath.c_str(), fmode);
    return thisFile;
}

The function always returns a UFile object.
Either the implementation needs to be adjusted or the documentation updated. In the latter case, there seems to be no way for the user to understand if the operation was successful.

Metadata

Metadata

Assignees

No one assigned

    Labels

    type: imperfectionPerceived defect in any part of project

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions