Soldered SD Card Arduino Library 1.0.0
Easily read and write files to and form the SD card breakout! A fork of the original SDFat library by Bill Greiman.
Loading...
Searching...
No Matches
ExFatVolume.h
Go to the documentation of this file.
1
25#ifndef ExFatVolume_h
26#define ExFatVolume_h
27#include "ExFatFile.h"
28#include "ExFatPartition.h"
29//==============================================================================
35{
36 public:
38 {
39 }
47 bool begin(BlockDevice *dev, bool setCwv = true, uint8_t part = 1)
48 {
49 if (!init(dev, part))
50 {
51 return false;
52 }
53 if (!chdir())
54 {
55 return false;
56 }
57 if (setCwv || !m_cwv)
58 {
59 m_cwv = this;
60 }
61 return true;
62 }
67 bool chdir()
68 {
69 m_vwd.close();
70 return m_vwd.openRoot(this);
71 }
77 bool chdir(const ExChar_t *path);
78
80 void chvol()
81 {
82 m_cwv = this;
83 }
84
92 bool exists(const ExChar_t *path)
93 {
94 ExFatFile tmp;
95 return tmp.open(this, path, O_RDONLY);
96 }
97
98 //----------------------------------------------------------------------------
113 bool ls(print_t *pr, uint8_t flags = 0)
114 {
115 return m_vwd.ls(pr, flags);
116 }
133 bool ls(print_t *pr, const ExChar_t *path, uint8_t flags)
134 {
135 ExFatFile dir;
136 return dir.open(this, path, O_RDONLY) && dir.ls(pr, flags);
137 }
146 bool mkdir(const ExChar_t *path, bool pFlag = true)
147 {
148 ExFatFile sub;
149 return sub.mkdir(vwd(), path, pFlag);
150 }
157 ExFile open(const ExChar_t *path, oflag_t oflag = O_RDONLY)
158 {
159 ExFile tmpFile;
160 tmpFile.open(this, path, oflag);
161 return tmpFile;
162 }
169 bool remove(const ExChar_t *path)
170 {
171 ExFatFile tmp;
172 return tmp.open(this, path, O_WRONLY) && tmp.remove();
173 }
188 bool rename(const ExChar_t *oldPath, const ExChar_t *newPath)
189 {
190 ExFatFile file;
191 return file.open(vwd(), oldPath, O_RDONLY) && file.rename(vwd(), newPath);
192 }
201 bool rmdir(const ExChar_t *path)
202 {
203 ExFatFile sub;
204 return sub.open(this, path, O_RDONLY) && sub.rmdir();
205 }
214 bool truncate(const ExChar_t *path, uint64_t length)
215 {
216 ExFatFile file;
217 if (!file.open(this, path, O_WRONLY))
218 {
219 return false;
220 }
221 return file.truncate(length);
222 }
223#if ENABLE_ARDUINO_SERIAL
228 bool ls()
229 {
230 return ls(&Serial);
231 }
244 bool ls(uint8_t flags)
245 {
246 return ls(&Serial, flags);
247 }
262 bool ls(const ExChar_t *path, uint8_t flags = 0)
263 {
264 return ls(&Serial, path, flags);
265 }
266#endif // ENABLE_ARDUINO_SERIAL
267#if ENABLE_ARDUINO_STRING
273 bool chdir(const String &path)
274 {
275 return chdir(path.c_str());
276 }
283 bool exists(const String &path)
284 {
285 return exists(path.c_str());
286 }
295 bool mkdir(const String &path, bool pFlag = true)
296 {
297 return mkdir(path.c_str(), pFlag);
298 }
305 ExFile open(const String &path, oflag_t oflag = O_RDONLY)
306 {
307 return open(path.c_str(), oflag);
308 }
315 bool remove(const String &path)
316 {
317 return remove(path.c_str());
318 }
333 bool rename(const String &oldPath, const String &newPath)
334 {
335 return rename(oldPath.c_str(), newPath.c_str());
336 }
345 bool rmdir(const String &path)
346 {
347 return rmdir(path.c_str());
348 }
357 bool truncate(const String &path, uint64_t length)
358 {
359 return truncate(path.c_str(), length);
360 }
361#endif // ENABLE_ARDUINO_STRING
362 //============================================================================
363#if USE_EXFAT_UNICODE_NAMES
364 // Not implemented when Unicode is selected.
365 bool exists(const char *path);
366 bool mkdir(const char *path, bool pFlag = true);
367 bool remove(const char *path);
368 bool rename(const char *oldPath, const char *newPath);
369 bool rmdir(const char *path);
370#endif // USE_EXFAT_UNICODE_NAMES
371
372 private:
373 friend ExFatFile;
374 static ExFatVolume *cwv()
375 {
376 return m_cwv;
377 }
379 {
380 return &m_vwd;
381 }
384};
385#endif // ExFatVolume_h
ExFatFile class.
ExFatPartition include file.
ExChar16_t ExChar_t
Definition ExFatTypes.h:39
int oflag_t
Definition FsApiConstants.h:45
Print print_t
Definition SysCall.h:66
BlockDeviceInterface class.
Definition BlockDeviceInterface.h:39
Basic file class.
Definition ExFatFile.h:95
bool rmdir()
Definition ExFatFileWrite.cpp:411
bool mkdir(ExFatFile *parent, const ExChar_t *path, bool pFlag=true)
Definition ExFatFileWrite.cpp:32
bool close()
Definition ExFatFile.cpp:31
bool remove()
Definition ExFatFileWrite.cpp:307
bool ls(print_t *pr)
Definition ExFatFilePrint.cpp:31
bool rename(const ExChar_t *newPath)
Definition ExFatFileWrite.cpp:44
bool truncate()
Definition ExFatFileWrite.cpp:59
bool open(ExFatFile *dirFile, const ExChar_t *path, oflag_t oflag)
Definition ExFatFile.cpp:215
bool openRoot(ExFatVolume *vol)
Definition ExFatFile.cpp:612
Access exFat partitions on raw file devices.
Definition ExFatPartition.h:47
bool init(BlockDevice *dev, uint8_t part)
Definition ExFatPartition.cpp:326
exFAT volume.
Definition ExFatVolume.h:35
bool mkdir(const String &path, bool pFlag=true)
Definition ExFatVolume.h:295
bool rename(const String &oldPath, const String &newPath)
Definition ExFatVolume.h:333
friend ExFatFile
Definition ExFatVolume.h:373
ExFile open(const String &path, oflag_t oflag=O_RDONLY)
Definition ExFatVolume.h:305
ExFatFile * vwd()
Definition ExFatVolume.h:378
static ExFatVolume * m_cwv
Definition ExFatVolume.h:382
bool mkdir(const ExChar_t *path, bool pFlag=true)
Definition ExFatVolume.h:146
ExFatFile m_vwd
Definition ExFatVolume.h:383
bool remove(const ExChar_t *path)
Definition ExFatVolume.h:169
bool exists(const char *path)
bool rename(const char *oldPath, const char *newPath)
void chvol()
Definition ExFatVolume.h:80
bool exists(const ExChar_t *path)
Definition ExFatVolume.h:92
bool rename(const ExChar_t *oldPath, const ExChar_t *newPath)
Definition ExFatVolume.h:188
ExFile open(const ExChar_t *path, oflag_t oflag=O_RDONLY)
Definition ExFatVolume.h:157
bool ls(print_t *pr, const ExChar_t *path, uint8_t flags)
Definition ExFatVolume.h:133
bool rmdir(const ExChar_t *path)
Definition ExFatVolume.h:201
bool mkdir(const char *path, bool pFlag=true)
bool chdir()
Definition ExFatVolume.h:67
bool ls(print_t *pr, uint8_t flags=0)
Definition ExFatVolume.h:113
bool ls()
Definition ExFatVolume.h:228
bool remove(const char *path)
static ExFatVolume * cwv()
Definition ExFatVolume.h:374
bool ls(const ExChar_t *path, uint8_t flags=0)
Definition ExFatVolume.h:262
bool remove(const String &path)
Definition ExFatVolume.h:315
bool begin(BlockDevice *dev, bool setCwv=true, uint8_t part=1)
Definition ExFatVolume.h:47
ExFatVolume()
Definition ExFatVolume.h:37
bool truncate(const ExChar_t *path, uint64_t length)
Definition ExFatVolume.h:214
bool truncate(const String &path, uint64_t length)
Definition ExFatVolume.h:357
bool ls(uint8_t flags)
Definition ExFatVolume.h:244
bool rmdir(const String &path)
Definition ExFatVolume.h:345
bool exists(const String &path)
Definition ExFatVolume.h:283
bool rmdir(const char *path)
bool chdir(const String &path)
Definition ExFatVolume.h:273
exFAT file with Arduino Stream.
Definition ExFatFile.h:895