Long filename open/create/write (#23526)

Co-authored-by: Scott Lahteine <github@thinkyhead.com>
This commit is contained in:
GHGiampy
2022-01-18 07:56:11 +01:00
committed by GitHub
parent 0c0ba6db7d
commit 1e246d65ad
8 changed files with 582 additions and 148 deletions

View File

@@ -377,8 +377,26 @@ class SdBaseFile {
dir_t* cacheDirEntry(uint8_t action);
int8_t lsPrintNext(uint8_t flags, uint8_t indent);
static bool make83Name(const char *str, uint8_t *name, const char **ptr);
bool mkdir(SdBaseFile *parent, const uint8_t dname[11]);
bool open(SdBaseFile *dirFile, const uint8_t dname[11], uint8_t oflag);
bool mkdir(SdBaseFile *parent, const uint8_t dname[11]
OPTARG(LONG_FILENAME_WRITE_SUPPORT, const uint8_t dlname[LONG_FILENAME_LENGTH])
);
bool open(SdBaseFile *dirFile, const uint8_t dname[11]
OPTARG(LONG_FILENAME_WRITE_SUPPORT, const uint8_t dlname[LONG_FILENAME_LENGTH])
, uint8_t oflag
);
bool openCachedEntry(uint8_t cacheIndex, uint8_t oflags);
dir_t* readDirCache();
// Long Filename create/write support
#if ENABLED(LONG_FILENAME_WRITE_SUPPORT)
static bool isDirLFN(const dir_t* dir);
static bool isDirNameLFN(const char *dirname);
static bool parsePath(const char *str, uint8_t *name, uint8_t *lname, const char **ptr);
/**
* Return the number of entries needed in the FAT for this LFN
*/
static inline uint8_t getLFNEntriesNum(const char *lname) { return (strlen(lname) + 12) / 13; }
static void getLFNName(vfat_t *vFatDir, char *lname, uint8_t startOffset);
static void setLFNName(vfat_t *vFatDir, char *lname, uint8_t lfnSequenceNumber);
#endif
};