Skip to content

createFile doesn't return NULL when it fails #56

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

Open
sebromero opened this issue May 5, 2025 · 0 comments
Open

createFile doesn't return NULL when it fails #56

sebromero opened this issue May 5, 2025 · 0 comments
Labels
type: imperfection Perceived defect in any part of project

Comments

@sebromero
Copy link
Contributor

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.

@per1234 per1234 added the type: imperfection Perceived defect in any part of project label May 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: imperfection Perceived defect in any part of project
Projects
None yet
Development

No branches or pull requests

2 participants