Skip to content

Commit 1296413

Browse files
committed
support extended ASCII filenames, handle hidden/system files
1 parent 85dbcca commit 1296413

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

src/utility/FatStructs.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -413,6 +413,6 @@ static inline uint8_t DIR_IS_SUBDIR(const dir_t* dir) {
413413
}
414414
/** Directory entry is for a file or subdirectory */
415415
static inline uint8_t DIR_IS_FILE_OR_SUBDIR(const dir_t* dir) {
416-
return (dir->attributes & DIR_ATT_VOLUME_ID) == 0;
416+
return (dir->attributes & (DIR_ATT_VOLUME_ID | DIR_ATT_SYSTEM | DIR_ATT_HIDDEN)) == 0;
417417
}
418418
#endif // FatStructs_h

src/utility/SdFat.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -437,7 +437,7 @@ class SdFile : public Print {
437437

438438
// private data
439439
uint8_t flags_; // See above for definition of flags_ bits
440-
uint8_t type_; // type of file see above for values
440+
uint8_t volatile type_; // type of file see above for values
441441
uint32_t curCluster_; // cluster for current file position
442442
uint32_t curPosition_; // current file position in bytes from beginning
443443
uint32_t dirBlock_; // SD block that contains directory entry for file

src/utility/SdFile.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -303,19 +303,19 @@ uint8_t SdFile::make83Name(const char* str, uint8_t* name) {
303303
// illegal FAT characters
304304
uint8_t b;
305305
#if defined(__AVR__)
306-
PGM_P p = PSTR("|<>^+=?/[];,*\"\\");
306+
PGM_P p = PSTR("|<>:+=?/[];,*\"\\");
307307
while ((b = pgm_read_byte(p++))) if (b == c) {
308308
return false;
309309
}
310310
#elif defined(__arm__)
311-
const uint8_t valid[] = "|<>^+=?/[];,*\"\\";
311+
const uint8_t valid[] = "|<>:+=?/[];,*\"\\";
312312
const uint8_t *p = valid;
313313
while ((b = *p++)) if (b == c) {
314314
return false;
315315
}
316316
#endif
317317
// check size and only allow ASCII printable characters
318-
if (i > n || c < 0X21 || c > 0X7E) {
318+
if (i > n || c < 0x20 || c == 0x7F) {
319319
return false;
320320
}
321321
// only upper case allowed in 8.3 names - convert lower to upper
@@ -1041,7 +1041,7 @@ uint8_t SdFile::rmRfStar(void) {
10411041
}
10421042

10431043
// skip if part of long file name or volume label in root
1044-
if (!DIR_IS_FILE_OR_SUBDIR(p)) {
1044+
if (p->attributes & DIR_ATT_VOLUME_ID) {
10451045
continue;
10461046
}
10471047

0 commit comments

Comments
 (0)