Skip to content

Conversation

@ewpa
Copy link

@ewpa ewpa commented May 20, 2019

... bytes by using CONFIG_SPIFFS_USE_MTIME=1 and CONFIG_SPIFFS_META_LENGTH=4
CPPFLAGS compile flags.

The ESP IDF stores file timestamps in 4 bytes of SPIFFS meta data. By using the above compile flags, this patch restores those timestamps when extracting files from a SPIFFS image file and recreates those timestamps by copying from the sources file(s) when creating a SPIFFS image file.

bytes by using CONFIG_SPIFFS_USE_MTIME=1 and CONFIG_SPIFFS_META_LENGTH=4
compile flags.
main.cpp Outdated
#if CONFIG_SPIFFS_USE_MTIME
struct stat sbuff;
stat(path, &sbuff);
SPIFFS_fupdate_meta(&s_fs, dst, &sbuff.st_mtime);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please handle the possibly different sizeof(time_t) explicitly? E.g.

uint32_t meta = (maybe truncate?) sbuff.st_mtime;
SPIFFS_fupdate_meta(&s_fs, dst, &meta);

And similar in unpackFile below.

and the SPIFFS image file, take into account that the word size and
endianness of the host architecture may be different to that stored in
the image file.
@ewpa
Copy link
Author

ewpa commented May 22, 2019

@igrr My latest commit goes one step further by also taking into consideration the host architecture endianness. I trust that is in the spirit of what you requested.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants