File base class

Open
#114 2 comments 4 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
30/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Stale
Tech stack
cpp
Domain
api, embedded-iot

Research direction

Read the existing File definitions in the SD and Bridge libraries, then compare the related Print, Stream, Client, and Server base classes. Define the shared API and verify that file-providing libraries can use it without consumers including SD.h; the issue does not name a test or specific entry-point.

Written by the indexing model from the issue text.

Description

Similar to Print, Stream, Client, Server... we probably need a File base class.

Currently File is defined in the SD library, and also in the Bridge library for Yun. Most programs in the Arduino ecosystem which use files are tied to the SD library. Because they include SD.h in their headers, the SD library is automatically brought into the project.

But the SD library isn't the only possible source for files. Flash chips, USB mass storage, network filesystems can also provide files. Without a base class, each library using files needs to be edited.

Use of alternate SD card libraries, like SdFat, is also very difficult without a base class because so many libraries which consume files are SD.h included by their code.

Hopefully the time has come to move File out of the SD library and into an abstract base class?

Dominant language
C++
Stars
306
Forks
150
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from arduino/ArduinoCore-API

All issues in arduino/ArduinoCore-API

Similar issues

More C++ issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.