8000 LittleFS: set create/modified FS times on format · esp8266/Arduino@869f066 · GitHub
[go: up one dir, main page]

Skip to content < 8000 span style="width: 0%;" data-view-component="true" class="Progress-item progress-pjax-loader-bar left-0 top-0 color-bg-accent-emphasis">

Commit 869f066

Browse files
committed
LittleFS: set create/modified FS times on format
1 parent f9bd73c commit 869f066

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

libraries/LittleFS/src/LittleFS.h

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,26 @@ class LittleFSImpl : public FSImpl
221221
return false;
222222
}
223223

224+
if(_timeCallback && _tryMount()) {
225+
// Mounting is required to set attributes
226+
227+
time_t t = _timeCallback();
228+
rc = lfs_setattr(&_lfs, "/", 'c', &t, 8);
229+
if (rc != 0) {
230+
DEBUGV("lfs_format, lfs_setattr 'c': rc=%d\n", rc);
231+
return false;
232+
}
233+
234+
rc = lfs_setattr(&_lfs, "/", 't', &t, 8);
235+
if (rc != 0) {
236+
DEBUGV("lfs_format, lfs_setattr 't': rc=%d\n", rc);
237+
return false;
238+
}
239+
240+
lfs_unmount(&_lfs);
241+
_mounted = false;
242+
}
243+
224244
if (wasMounted) {
225245
return _tryMount();
226246
}

0 commit comments

Comments
 (0)
0