mirror of
https://github.com/0xFEEDC0DE64/arduino-esp32.git
synced 2025-07-03 22:06:32 +02:00
Unify time modification on SD and SPIFFS (#738)
* Add access to last write date time add example * rename cpp to ino orz * wrong copy -past * No comment orz * Add missing space
This commit is contained in:
@ -32,6 +32,15 @@ size_t File::write(uint8_t c)
|
||||
return _p->write(&c, 1);
|
||||
}
|
||||
|
||||
time_t File::getLastWrite()
|
||||
{
|
||||
if (!_p) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return _p->getLastWrite();
|
||||
}
|
||||
|
||||
size_t File::write(const uint8_t *buf, size_t size)
|
||||
{
|
||||
if (!_p) {
|
||||
|
@ -70,6 +70,7 @@ public:
|
||||
size_t size() const;
|
||||
void close();
|
||||
operator bool() const;
|
||||
time_t getLastWrite();
|
||||
const char* name() const;
|
||||
|
||||
boolean isDirectory(void);
|
||||
|
@ -37,6 +37,7 @@ public:
|
||||
virtual size_t position() const = 0;
|
||||
virtual size_t size() const = 0;
|
||||
virtual void close() = 0;
|
||||
virtual time_t getLastWrite() = 0;
|
||||
virtual const char* name() const = 0;
|
||||
virtual boolean isDirectory(void) = 0;
|
||||
virtual FileImplPtr openNextFile(const char* mode) = 0;
|
||||
|
@ -295,6 +295,11 @@ VFSFileImpl::operator bool()
|
||||
return (_isDirectory && _d != NULL) || _f != NULL;
|
||||
}
|
||||
|
||||
time_t VFSFileImpl::getLastWrite() {
|
||||
_getStat() ;
|
||||
return _stat.st_mtime;
|
||||
}
|
||||
|
||||
void VFSFileImpl::_getStat() const
|
||||
{
|
||||
if(!_path) {
|
||||
|
@ -67,6 +67,7 @@ public:
|
||||
size_t size() const override;
|
||||
void close() override;
|
||||
const char* name() const override;
|
||||
time_t getLastWrite() override;
|
||||
boolean isDirectory(void) override;
|
||||
FileImplPtr openNextFile(const char* mode) override;
|
||||
void rewindDirectory(void) override;
|
||||
|
Reference in New Issue
Block a user