Skip to content

Commit eaffb91

Browse files
author
Federico Fissore
committed
Added File.isDirectory()
1 parent f149dac commit eaffb91

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

hardware/arduino/avr/libraries/Bridge/FileIO.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,17 @@ const char *File::name() {
150150
return filename.c_str();
151151
}
152152

153+
154+
boolean File::isDirectory() {
155+
uint8_t res[1];
156+
uint8_t lenght;
157+
uint8_t cmd[] = {'i'};
158+
if (mode != 255)
159+
return 0;
160+
161+
bridge.transfer(cmd, 1, (uint8_t *)filename.c_str(), filename.length(), res, 1);
162+
return res[0];
163+
}
153164
//boolean isDirectory(void)
154165
//File openNextFile(uint8_t mode = O_RDONLY);
155166
//void rewindDirectory(void)

hardware/arduino/avr/libraries/Bridge/FileIO.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ class File : public Stream {
4545
void close();
4646
operator bool();
4747
const char * name();
48-
48+
boolean isDirectory();
4949
boolean iFileSystemirectory(void);
5050
File openNextFile(uint8_t mode = FILE_READ);
5151
void rewindDirectory(void);

0 commit comments

Comments
 (0)