diff options
author | Federico Fissore <f.fissore@arduino.cc> | 2013-07-11 13:06:48 +0200 |
---|---|---|
committer | Federico Fissore <f.fissore@arduino.cc> | 2013-07-11 13:06:48 +0200 |
commit | 40b2da774627948454d05ca9d59463ca13df9796 (patch) | |
tree | 7ee33b71343c21eb54b82a978fd84d716f14d02f | |
parent | 3ee30f326f3a9f2ffd42c8808656708a710fef6f (diff) |
Added File.isDirectory()
-rw-r--r-- | libraries/Bridge/FileIO.cpp | 11 | ||||
-rw-r--r-- | libraries/Bridge/FileIO.h | 2 |
2 files changed, 12 insertions, 1 deletions
diff --git a/libraries/Bridge/FileIO.cpp b/libraries/Bridge/FileIO.cpp index 0fab55f..4339c8e 100644 --- a/libraries/Bridge/FileIO.cpp +++ b/libraries/Bridge/FileIO.cpp @@ -150,6 +150,17 @@ const char *File::name() { return filename.c_str(); } + +boolean File::isDirectory() { + uint8_t res[1]; + uint8_t lenght; + uint8_t cmd[] = {'i'}; + if (mode != 255) + return 0; + + bridge.transfer(cmd, 1, (uint8_t *)filename.c_str(), filename.length(), res, 1); + return res[0]; +} //boolean isDirectory(void) //File openNextFile(uint8_t mode = O_RDONLY); //void rewindDirectory(void) diff --git a/libraries/Bridge/FileIO.h b/libraries/Bridge/FileIO.h index 629e5f2..c38ba07 100644 --- a/libraries/Bridge/FileIO.h +++ b/libraries/Bridge/FileIO.h @@ -45,7 +45,7 @@ public: void close(); operator bool(); const char * name(); - + boolean isDirectory(); boolean iFileSystemirectory(void); File openNextFile(uint8_t mode = FILE_READ); void rewindDirectory(void); |