Fork of FATFileSystem that exposes FILINFO in the FATDirHandle. This allows obtaining true file sizes and testing whether a dir pointer is a directory or a file.
Dependents: SDFileSystemNoStall
Fork of FATFileSystem by
FATDirHandle.h@5:f40c1ca31913, 2014-10-30 (annotated)
- Committer:
- uci1
- Date:
- Thu Oct 30 06:19:16 2014 +0000
- Revision:
- 5:f40c1ca31913
- Parent:
- 1:46ce1e16c870
Expose the current FILINFO object via filinfo(), allowing the true file size of the current file to be obtained and allowing the current directory pointer to be tested to see if it's a file or directory, etc.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
emilmont | 1:46ce1e16c870 | 1 | /* mbed Microcontroller Library |
emilmont | 1:46ce1e16c870 | 2 | * Copyright (c) 2006-2012 ARM Limited |
emilmont | 1:46ce1e16c870 | 3 | * |
emilmont | 1:46ce1e16c870 | 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy |
emilmont | 1:46ce1e16c870 | 5 | * of this software and associated documentation files (the "Software"), to deal |
emilmont | 1:46ce1e16c870 | 6 | * in the Software without restriction, including without limitation the rights |
emilmont | 1:46ce1e16c870 | 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
emilmont | 1:46ce1e16c870 | 8 | * copies of the Software, and to permit persons to whom the Software is |
emilmont | 1:46ce1e16c870 | 9 | * furnished to do so, subject to the following conditions: |
emilmont | 1:46ce1e16c870 | 10 | * |
emilmont | 1:46ce1e16c870 | 11 | * The above copyright notice and this permission notice shall be included in |
emilmont | 1:46ce1e16c870 | 12 | * all copies or substantial portions of the Software. |
emilmont | 1:46ce1e16c870 | 13 | * |
emilmont | 1:46ce1e16c870 | 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
emilmont | 1:46ce1e16c870 | 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
emilmont | 1:46ce1e16c870 | 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
emilmont | 1:46ce1e16c870 | 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
emilmont | 1:46ce1e16c870 | 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
emilmont | 1:46ce1e16c870 | 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
emilmont | 1:46ce1e16c870 | 20 | * SOFTWARE. |
emilmont | 1:46ce1e16c870 | 21 | */ |
emilmont | 1:46ce1e16c870 | 22 | #ifndef MBED_FATDIRHANDLE_H |
emilmont | 1:46ce1e16c870 | 23 | #define MBED_FATDIRHANDLE_H |
emilmont | 1:46ce1e16c870 | 24 | |
emilmont | 1:46ce1e16c870 | 25 | #include "DirHandle.h" |
uci1 | 5:f40c1ca31913 | 26 | //struct FILINFO; |
emilmont | 1:46ce1e16c870 | 27 | |
emilmont | 1:46ce1e16c870 | 28 | using namespace mbed; |
emilmont | 1:46ce1e16c870 | 29 | |
emilmont | 1:46ce1e16c870 | 30 | class FATDirHandle : public DirHandle { |
emilmont | 1:46ce1e16c870 | 31 | |
emilmont | 1:46ce1e16c870 | 32 | public: |
emilmont | 1:46ce1e16c870 | 33 | FATDirHandle(const FATFS_DIR &the_dir); |
emilmont | 1:46ce1e16c870 | 34 | virtual int closedir(); |
emilmont | 1:46ce1e16c870 | 35 | virtual struct dirent *readdir(); |
emilmont | 1:46ce1e16c870 | 36 | virtual void rewinddir(); |
emilmont | 1:46ce1e16c870 | 37 | virtual off_t telldir(); |
emilmont | 1:46ce1e16c870 | 38 | virtual void seekdir(off_t location); |
uci1 | 5:f40c1ca31913 | 39 | virtual const FILINFO *filinfo() { return &cur_filinfo; } |
emilmont | 1:46ce1e16c870 | 40 | |
emilmont | 1:46ce1e16c870 | 41 | private: |
emilmont | 1:46ce1e16c870 | 42 | FATFS_DIR dir; |
uci1 | 5:f40c1ca31913 | 43 | FILINFO cur_filinfo; |
emilmont | 1:46ce1e16c870 | 44 | struct dirent cur_entry; |
emilmont | 1:46ce1e16c870 | 45 | |
emilmont | 1:46ce1e16c870 | 46 | }; |
emilmont | 1:46ce1e16c870 | 47 | |
emilmont | 1:46ce1e16c870 | 48 | #endif |